
I've passed on new time zone stuff to some other folks on the list; after their editing, the stuff should be posted to mod.sources. It will (in all probability) include "food for thought" code for six (count 'em, six) functions for turning time_t's into struct tm's and back: struct tm * localtime(time_t t) struct tm * gmtime(time_t t) struct tm * offtime(time_t t, long offset) time_t timelocal(struct tm * tmp) time_t timegm(struct tm * tmp) time_t timeoff(struct tm * tmp, long offset) localtime and gmtime are our old friends. offtime is like gmtime except that the given offset (in seconds) is used in generating the return value. (You want to do this, rather than adding the offset to the time and calling gmtime, to avoid overflow problems at near-minimum and near-maximum time_t values.) timelocal, timegm, and timeoff "invert" their counterparts (well, actually, they just try to do an adequate job). The troff-ish assumption with localtime and timelocal is that "the same local time conversion rules must still (or again) be in effect" when timelocal is called as were in effect when localtime was called to get the "right" inversion. None of the inverting functions gives a hoot about tm_isdst. There's surely a better way to do things. --ado
participants (1)
-
Arthur David Olson