Mail Archives: djgpp/1994/06/21/15:05:25
Since I just _happen_ to be busily solving this same problem myself,
using in part clues from this email echo, here's what I've learned,
about the TZ environmental variable, doing the same task with Borland
C++, to support military weather forecasters using Greenwich Mean
Time:
1) It is undocumented for BCC, that the time functions consult the TZ
environmental variable. Nonetheless, as a few sets and unsets have
demonstrated, they do, and give different results for different
settings.
2) The TZ environmental variable is in three parts: a three character
standard time zone name, a signed integer number of hours to be
added to or subtracted from local standard time to get Greenwich
Mean Time, and a daylight savings time zone name, to be included
_only_ during actual daylight savings time, as best I can tell. I
sit in Pacific Daylight Time, Monterey, California, USA, so my TZ
setting is:
set TZ=PST+8PDT
This is because my local standard time zone name is PDT, my standard
time is eight hours behind GMT, so I have to add 8 hours to get GMT,
and it is in fact Daylight Savings Time here and now..
3) If the TZ environmental variable is _not_ set, the default is a
USA-centric Eastern Standard Time, the equivalent of
set TZ=EST+5
more than likely because that is the timezone of the originators of
C and Unix.
4) Because PCs don't keep the extensive tables that Unix systems do,
supporting translations of the standard time zone name to a set of
rules for daylight savings time, very likely _any_ three letters
would do where I have PST and PDT, and the two useful data are
the hour offset and the existance of the second three letters. When
you dump the values of the standard external variables timezone and
daylight, you get the hour offset converted to seconds in timezone,
and either a one or a zero in daylight.
Hope this helps, as your notes helped point me to the TZ environmental
variable being missing as the likely source of my five hour error in
doing GMT conversions.
Xanthian.
--
Kent, the man from xanth.
Kent Paul Dolan.
<dolan AT fnoc DOT navy DOT mil>
<xanthian AT well DOT sf DOT ca DOT us>
- Raw text -