mktime

Mark Horton seismo!cbpavo.MIS.OH.ATT.COM!mark
Sat Feb 7 00:08:02 UTC 1987


If we're to view mktime as a general-purpose converter from struct tm
to time_t, there's a gotcha waiting:  struct tm doesn't contain any
time zone information (the isdst flag doesn't help) and hence this
conversion is ambiguous, unless you assume the local time zone or gmtime
or some such thing.  That's not a good assumption to make.

In my implementation, I added two fields to struct tm, for the hours and
minutes in the time zone (both are negative for us in the USA; well, I
guess -0 is still 0 for the minutes) which resolved the ambiguity.
I'm not sure if this change can be made in general without breaking things,
and it could have been done with one field.  The offset defines the tme
zone the actual value in the struct tm is in; the isdst flag doesn't really
have anything to do with it.

	Mark




More information about the tz mailing list