Dear all,
there appears to be a bug in the libc definition of tzset(), both
under 4.0F (PK#2 + NHDv3) and 4.0G (PK#2).
According to the documentation for tzset(3) [man 3 tzset]:
``
The external variable timezone is set to the difference, in seconds,
between Coordinated Universal Time (UTC) and local standard time. For
example:
TZ timezone
EST 5*60*60
GMT 0*60*60
JST -9*60*60
MET -1*60*60
MST 7*60*60
PST 8*60*60
''
This does not appear to be the case:
/* tzset-test.c */
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
main()
{
char *timezone="TZ=GMT0";
putenv(timezone);
tzset();
printf("daylight=%d\ntimezone=%ld\ntzname[0]=%s\ntzname[1]=%s\n",
daylight, timezone,
(tzname[0] ? tzname[0] : "NULL"),
(tzname[1] ? tzname[0] : "NULL"));
exit(0);
}
terracotta:/tmp$ ./tzset-test
daylight=0
timezone=5368709312
tzname[0]=GMT
tzname[1]=GMT
The timezone value should be 0 according to the man page. The
remaining values are correct. Linux appears to have the same problem.
umbra:/tmp$ ./tzset-test
daylight=0
timezone=134514176
tzname[0]=GMT
tzname[1]=GMT
Does this mean that the timezone variable should not be trusted?
Best Regards,
Arrigo Triulzi
--
Arrigo Triulzi <arrigo_at_albourne.com>
Albourne Partners Ltd. - London, UK
Received on Tue Mar 27 2001 - 15:01:45 NZST