dt_status_t dt_tm_to_representation()

in src/dt.c [496:510]


dt_status_t dt_tm_to_representation(const struct tm *tm, long nano_second, dt_representation_t *representation)
{
    if (!tm || !representation) {
        return DT_INVALID_ARGUMENT;
    }
    memset(representation, 0, sizeof(dt_representation_t));
    representation->year = 1900 + tm->tm_year;
    representation->month = tm->tm_mon + 1;
    representation->day = tm->tm_mday;
    representation->hour = tm->tm_hour;
    representation->minute = tm->tm_min;
    representation->second = tm->tm_sec;
    representation->nano_second = nano_second;
    return DT_OK;
}