On Sat, 2 Dec 2000 01:37:20 +0100,
"Guido Van Hoecke" <[EMAIL PROTECTED]> wrote:
>Jonathan,
>
>Things work allright if I remove the TZ variable alltogether.
>
>But this is not really a solution. I continuously switch between unix,
nt
>and win2k and I am using RCS as revision control system in each of these
>environments. RCS does not work if the timezone is not set. And
according to
>the books, Perl should work properly with timezones, which it does on
Unix.
>
>I think that this really is a bug in the ActiveState implementation.
------------------------- >8 snip 8< --------------------------
> My timezone is MET which is the same as GMT+1,
> so localtime should be one hour later as gmtime.
> But it's not :
>
> print
> 'timezone = ' . $ENV{TZ} . '\n' .
> 'localtime = ' . localtime . '\n' .
> 'gmtime = ' . gmtime . '\n';
>
> prints
>
> timezone = MET
> localtime = Fri Dec 1 17:38:15 2000
> gmtime = Fri Dec 1 17:38:15 2000
>
------------------------- >8 snip 8< --------------------------
Hi all,
This is *not* a bug. If you are going to use the TZ environment
variable, it must include the offset from UTC/GMT. For example,
my timezone is EST, which is 5 hours behind UTC. I would set
TZ=EST5EDT. The EDT being for daylight savings time. Since
MET is 1 hour ahead of UTC, TZ=MET-1 (or TZ=MET23 if you
want to be unusual :-)) will do the trick, ignoring daylight savings.
You might think it should be MET+1, but not according to my
experiments.
Note also setting $ENV{TZ} will *not* have any affect on localtime().
If you are going to use TZ, it must be set before Perl executes.
Sub-processes from, say, system() or `...` will inherit changes to
$ENV{TZ}, but it appears that Perl makes no attempt to reflect
changes in %ENV into the current process' environment.
Now, *that* might be considered a bug!
HTH,
Jonathan D Johnston
PS. The following is from the MSVC documentation for the C library
function _tzset():
Use the following syntax to set the TZ environment variable:
set TZ=tzn[+ | �]hh[:mm[:ss] ][dzn]
tzn
Three-letter time-zone name, such as PST. You must specify the correct
offset from local time to UTC.
hh
Difference in hours between UTC and local time. Optionally signed.
mm
Minutes. Separated from hh by a colon (:).
ss
Seconds. Separated from mm by a colon (:).
dzn
Three-letter daylight-saving-time zone such as PDT. If daylight saving
time is never in effect in the locality, set TZ without a value for dzn.
The C run-time library assumes the United States�s rules for implementing
the calculation of Daylight Saving Time (DST).
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl