int main(int argc, char *argv[]) { struct tm tms; struct tm *tmp = &tms; time_t ltime; tz_t *tz; /* Get the current time */ ltime = time(NULL); /* Compute the local current time now for several localities, based on Posix tz strings */ tz = tz_init(NULL, "GMT0GMT0,M10.5.0,M3.5.0"); tz_localtime(tz, tmp, ltime); printf("Local time is %02d:%02d:%02d\n", tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf("Time zone is %s\n", tz_tzname(tz, tmp->tm_isdst)); tz_init(tz, "CST-8CST-8,M10.5.0,M3.5.0"); tz_localtime(tz, tmp, ltime); printf("Local time is %02d:%02d:%02d\n", tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf("Time zone is %s\n", tz_tzname(tz, tmp->tm_isdst)); tz_init(tz, "AEST-10AEDT-11,M10.5.0,M3.5.0"); tz_localtime(tz, tmp, ltime); printf("Local time is %02d:%02d:%02d\n", tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf("Time zone is %s\n", tz_tzname(tz, tmp->tm_isdst)); tz_free(tz); return 0; }
dt_status_t dt_timezone_cleanup(dt_timezone_t *timezone) { if (timezone == NULL) { return DT_INVALID_ARGUMENT; } tz_free(timezone->state); return DT_OK; }