[LCP]Time conversions

Jack Lloyd lloyd at acm.jhu.edu
Wed Nov 27 05:48:01 UTC 2002


I have an interesting time conversion problem. Basically, my application is
reading in a string specifying a time in UTC/GMT. I parse this down to some
integers (year, month, ..., second). At some later time, I would like to
convert this into a time_t (so it can be compared with another time_t
passed in by the application). The obvious way to do this would be to fill
in a struct tm with the values and call mktime. Unfortunatly mktime expects
a struct tm in localtime, and there is no alternative version for UTC as
there is for localtime.

Any ideas?




More information about the linuxCprogramming mailing list