|
From: Ilana L. <il...@is...> - 2005-01-21 07:51:05
|
Hi,
I have been looking at the timezone code again, focussing on the=20
example=A0supplied by Tor Lillqvist. =A0I was a bit in the dark about time =
zones=20
but now have a better understanding (and more questions :-).
In Linux, the tzselect program is used to set the TZ variable by selecting =
a =20
specific time zone e.g. =A0Africa/Johannesburg.
This then actually points to a time zone file=20
e.g. /usr/share/zoneinfo/Africa/Johannesburg (the file specification is=20
relative to the system timezone directory). =A0This file has to be in=20
a=A0specific format namely the tzfile format. =A0When tzset() is called, th=
is=20
file is read and interpreted.
Local time functions will then use these values when converting GMT to loca=
l=20
time.
As an example, the following code will use the Johannesburg time zone=20
variables:
putenv("TZ=3D:/usr/share/zoneinfo/Africa/Johannesburg");
tzset();
Tor stated that setting TZ=3DAfrica/Johannesburg is illegal. =A0I have trie=
d to=20
do the same on Windows (mingw) anyway, but it seems as if it does not=20
have this functionality presently.
In addition, the time zone file contains information about daylight savings=
=20
time as well as changes to conversion rules. =A0This enables one to read=20
historic GMT time data and convert it correctly to local time.
=46rom the time zone code documentation I found the following:
=2D->
In SVR2, the TZ variable had to be a three-letter time zone, followed by a=
=20
number representing the difference between local time and Greenwich Mean Ti=
me=20
in hours, followed by an optional three-letter name for a daylight time=20
zone;" when the optional daylight time zone is present, "standard U.S.A.
Daylight Savings Time conversion is applied." This means that SVR2 cannot=20
handle other (for example, Australian) daylight savings time rules, or=20
situations where more than two time zone abbreviations are used in an area.
This have been improved and The "TZ" environment variable is used in=20
generating the name of a file from which time zone information is read (or =
is=20
interpreted a la POSIX); "TZ" is no longer constrained to be a three-letter=
=20
time zone name followed by a number of hours and an optional three-letter=20
daylight time zone name. =A0The daylight saving time rules to be used for a=
=20
particular time zone are encoded in the time zone file; the format of the=20
file allows U.S., Australian, and other rules to be encoded, and allows for=
=20
situations where more than two time zone abbreviations are used.
<--
I am uncertain as to how mingw libraries work (whether it is e.g. a layer o=
n=20
top of the microsoft libraries), but it appears as if only the old method=20
(three-letter time zone) of setting TZ is supported. =A0Does anyone know of=
a=20
workaround for this problem? Is there perhaps a way to override the curren=
t=20
date functions?
Regards,
Ilana
=2D-=20
Ilana Loubser
ISS International Limited, Technology Division, Software Engineering=20
P O Box 12063, DIE BOORD 7613, South Africa
Tel: +27 (0)21 809-2091 Fax: +27 (0)21 809-2061
Email: il...@is... Web Page: http://www.issi.co.za
Confidentiality Warning
____________________________________________________________________
This e-mail message contains confidential information which is
intended for the use of the person to whom it is addressed. If you
received it in error, please notify the sender and delete the
material from any computer. Any disclosure, re-transmission,
dissemination or any other use of this information is strictly
prohibited.
____________________________________________________________________
|