|
2004-05-15
| ||
| 04:44 | • Closed ticket [940278ffff]: env(TZ) has delayed effect on clock format plus ... artifact: 87e3a37ced user: kennykb | |
|
2004-04-24
| ||
| 04:15 | • Ticket [940278ffff]: 4 changes artifact: 5c7ce23346 user: davidw | |
|
2004-04-23
| ||
| 03:44 | • Ticket [940278ffff]: 4 changes artifact: ec51219ac5 user: davidw | |
|
2004-04-22
| ||
| 20:03 | • New ticket [940278ffff]. artifact: 5543a5a91f user: davidw | |
env(TZ) has delayed effect on clock format
Closed / Fixed940278ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-04-22 20:03:29
This script:
----
if { ! [info exists env(TZ) ] } {
set myTZ ""
} else {
set myTZ $env(TZ)
}
puts "Local time is [clock format [clock seconds]]"
set env(TZ) GMT+8
puts "Time in Eugene, Oregon is [clock format [clock
seconds]]"
set env(TZ) GMT-1
puts "Time in Padua, Italy is [clock format [clock
seconds]]"
if { $myTZ == "" } {
unset env(TZ)
} else {
set env(TZ) $myTZ
}
----
does not produce the desired results, in either 8.4.6
or 8.5.
kbk found that HAVE_TZSET is not tested for in the
configure scripts, except for some crufty unix systems.
He also proposed commenting out the calledTzset = 1;
on or around line 285.
Further bulletins as events warrant.
davidwplain2004-04-23 03:44:02
Logged In: YES
user_id=240
This works on my system (linux, modern kernel, modern glibc):
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
time_t thetime = 0;
struct tm *tms;
time(&thetime);
setenv("TZ", "GMT-1", 1);
tms = localtime(&thetime);
printf("padova hour %d\n", tms->tm_hour);
setenv("TZ", "GMT+8", 1);
tms = localtime(&thetime);
printf("eugene hour %d\n", tms->tm_hour);
}
davidwplain2004-04-24 04:15:33
Logged In: YES user_id=240 It seems as if the problem may be that localtime_r does not call tzset, as normal localtime does. Note that there are also some discrepencies between tclUnixThrd.c and tclUnixTime.c. The first globally redefines localtime, whereas the second also checks if HAVE_LOCALTIME_R is defined. This conflict ought to be resolved.
kennykbplain2004-05-15 04:44:12
Logged In: YES user_id=99768 Put in changes to call tzset whenever $env(TZ) changes.
Log in (anonymous is fine) to add a comment.