timezone dst transition
Dan Eisenhut
deisenhut@wi.rr.com
Wed Jun 9 18:09:00 GMT 2004
On Wed, 2004-06-09 at 09:11, Andreas Schwab wrote:
> "Eisenhut, Daniel (MED)" <Daniel.Eisenhut@med.ge.com> writes:
>
> > I'm working on an application that needs to know the date and time of
> > the next transition to or from daylight savings time.
>
> See zdump(1).
I took a look at glibc/timezone/zdump.c. It figures out the next
transition by taking the current time (as a time_t) in a local variable
and also a value 12 hours in the future. It takes the broken down
versions of both and compares to see if tm_isdst has changed. It
repeats at 12 hour increments until tm_isdst does change and then hunts
down where in that 12 hours it changes by using a halfing scheme.
This seems like a rather expensive operation compared to parsing the
TZif file (out of a ramdisk). If this is the way zdump figures it out,
I take it that a way of directly accessing the transition time doesn't
exist in glibc. Is there a glibc wishlist I could add to?
Thanks,
Dan
More information about the Libc-alpha
mailing list