diff options
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/Time-Piece/Piece.pm | 13 | ||||
-rw-r--r-- | cpan/Time-Piece/Piece.xs | 18 | ||||
-rw-r--r-- | cpan/Time-Piece/Seconds.pm | 2 | ||||
-rw-r--r-- | cpan/Time-Piece/t/02core_dst.t | 9 |
4 files changed, 31 insertions, 11 deletions
diff --git a/cpan/Time-Piece/Piece.pm b/cpan/Time-Piece/Piece.pm index a8b80fc9a4..6dbf4d69c4 100644 --- a/cpan/Time-Piece/Piece.pm +++ b/cpan/Time-Piece/Piece.pm @@ -2,10 +2,13 @@ package Time::Piece; use strict; +require DynaLoader; use Time::Seconds; use Carp; use Time::Local; +our @ISA = qw(DynaLoader); + use Exporter (); our @EXPORT = qw( @@ -17,13 +20,9 @@ our %EXPORT_TAGS = ( ':override' => 'internal', ); -our $VERSION = '1.30'; +our $VERSION = '1.31'; -require DynaLoader; -{ - local *dl_load_flags = \&DynaLoader::dl_load_flags; - __PACKAGE__->DynaLoader::bootstrap($VERSION); -} +bootstrap Time::Piece $VERSION; my $DATE_SEP = '-'; my $TIME_SEP = ':'; @@ -714,7 +713,7 @@ following methods are available on the object: $t->week # week number (ISO 8601) - $t->is_leap_year # true if it its + $t->is_leap_year # true if it's a leap year $t->month_last_day # 28-31 $t->time_separator($s) # set the default separator (default ":") diff --git a/cpan/Time-Piece/Piece.xs b/cpan/Time-Piece/Piece.xs index eafb790a29..3441bd799b 100644 --- a/cpan/Time-Piece/Piece.xs +++ b/cpan/Time-Piece/Piece.xs @@ -153,8 +153,22 @@ fix_win32_tzenv(void) if (crt_tz_env == NULL) crt_tz_env = ""; if (strcmp(perl_tz_env, crt_tz_env) != 0) { - newenv = (char*)malloc((strlen(perl_tz_env) + 4) * sizeof(char)); + STRLEN perl_tz_env_len = strlen(perl_tz_env); + newenv = (char*)malloc((perl_tz_env_len + 4) * sizeof(char)); if (newenv != NULL) { +/* putenv with old MS CRTs will cause a double free internally if you delete + an env var with the CRT env that doesn't exist in Win32 env (perl %ENV only + modifies the Win32 env, not CRT env), so always create the env var in Win32 + env before deleting it with CRT env api, so the error branch never executes + in __crtsetenv after SetEnvironmentVariableA executes inside __crtsetenv. + + VC 9/2008 and up dont have this bug, older VC (msvcrt80.dll and older) and + mingw (msvcrt.dll) have it see [perl #125529] +*/ +#if !(_MSC_VER >= 1500) + if(!perl_tz_env_len) + SetEnvironmentVariableA("TZ", ""); +#endif sprintf(newenv, "TZ=%s", perl_tz_env); putenv(newenv); if (oldenv != NULL) @@ -1012,7 +1026,7 @@ _strftime(fmt, epoch, islocal = 1) { char tmpbuf[128]; struct tm mytm; - int len; + size_t len; if(islocal == 1) mytm = *localtime(&epoch); diff --git a/cpan/Time-Piece/Seconds.pm b/cpan/Time-Piece/Seconds.pm index fb5d44146a..965e3a6e50 100644 --- a/cpan/Time-Piece/Seconds.pm +++ b/cpan/Time-Piece/Seconds.pm @@ -1,7 +1,7 @@ package Time::Seconds; use strict; -our $VERSION = '1.30'; +our $VERSION = '1.31'; use Exporter 5.57 'import'; diff --git a/cpan/Time-Piece/t/02core_dst.t b/cpan/Time-Piece/t/02core_dst.t index 292251470d..4e12fb6694 100644 --- a/cpan/Time-Piece/t/02core_dst.t +++ b/cpan/Time-Piece/t/02core_dst.t @@ -3,11 +3,16 @@ use Test::More tests => 60; my $is_win32 = ($^O =~ /Win32/); my $is_qnx = ($^O eq 'qnx'); my $is_vos = ($^O eq 'vos'); +my $is_linux = ($^O =~ /linux/); +my $is_bsd = ($^O =~ /bsd/); +my $is_mac = ($^O =~ /darwin/); use Time::Piece; use Time::Seconds; #test using an epoch that can be DST +#because sometimes funny stuff can occur [cpan #93095] +#https://rt.cpan.org/Ticket/Display.html?id=93095#txn-1482590 my $t = gmtime(1373371631); # 2013-07-09T12:07:11 @@ -119,7 +124,9 @@ ok(not $t->is_leap_year); # should test more with different dates cmp_ok($t->month_last_day, '==', 31); # test more -{ +SKIP: { + skip "Extra tests for Linux, BSD only.", 6 unless $is_linux or $is_mac or $is_bsd; + local $ENV{TZ} = "EST5EDT4"; Time::Piece::_tzset(); my $lt = localtime(1373371631); #2013-07-09T12:07:11 |