Subject: | tzname is not restored properly |
Threaded perl has a problem about timezone, which would cause
Date::Simple behaving unproperly.
http://rt.perl.org/rt3/Public/Bug/Display.html?id=26136
Here is a patch for the problem:
$ diff -r Date-Simple-3.02.orig Date-Simple-3.02
diff -r Date-Simple-3.02.orig/lib/Date/Simple.pm
Date-Simple-3.02/lib/Date/Simple.pm
158a159
160,161c161,174
< local $ENV{TZ} = 'UTC+0';
< return POSIX::strftime ($format, _gmtime ($self));
---
Show quoted text
> my $exists_env_tz = exists $ENV{TZ};
> my $tz = $ENV{TZ} if $exists_env_tz;
>
> $ENV{TZ} = 'UTC+0';
> my $result = POSIX::strftime ($format, _gmtime ($self));
>
> if ( $exists_env_tz ) {
> $ENV{TZ} = $tz;
> } else {
> delete $ENV{TZ};
> }
> POSIX::tzset();
>
> return $result;
The patch is still not thread safe, but somehow it can resolve the
problem in most cases.