
I was pointed in the direction of this list about the question I have. If anyone can offer any help I'd really appreciate an email response at sautins@coralsys.com. I am writing an application that is continually needing to get the offset from GMT for different times and different timezones. The method of setting the timezone environment variable, calling tzset, and calling localtime is entirely too costly (mostly the time spent opening and closing the timezone files). In any case, I've been perusing the code from ftp::/elsie.nci.nih.gov/pub/tzcode95c.tar and am confused by the following piece of code from localsub: if (sp->timecnt == 0 || t < sp->ats[0]) { i = 0; while (sp->ttis[i].tt_isdst) if (++i >= sp->typecnt) { i = 0; break; } } else {
for (i = 1; i < sp->timecnt; ++i) if (t < sp->ats[i]) break; i = sp->types[i - 1]; }
ttisp = &sp->ttis[i]; It seems that the only place that the time being converted is used to determine which ttinfo struct is in the comparison with the 'ats' field. The ats field is an array of time_t values, but for the life of me I can't figure out how this would work. My question is, how does this address the issue of, in May it's is or is not daylight savings time? I can't figure out how the ats filed works. From the header, it says that they are transition times, but when looking at the debugger at the ast values and the all seem to be large negative values. Can anyone shed some light on what's going on or point me in the direction of some documentation on this algorithm? Please direct responses to 'sautins@coralsys.com' Thank you VERY much. -drew sautins@coralsys.com
participants (1)
-
sautins@coralsys.com