Subject: | Fix DST test on linux-musl systems |
Date: | Sun, 13 Jan 2019 21:19:10 -0600 |
To: | bug-Time-Piece [...] rt.cpan.org |
From: | Samuel Holland <samuel [...] sholland.org> |
There is no default set of DST rules given in the POSIX specification for time
zone strings[1]. glibc uses the DST rules for America/New_York as an extension,
but musl libc does not. On musl, when no rules are available, timestamps are not
interpreted as standard/daylight time based on the date. By providing DST rules,
the test now passes in this environment. These happen to be the DST rules for
America/New_York, but the details aren't important, as long as January is
standard time and July is daylight time.
[1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
--- a/t/02core_dst.t
+++ b/t/02core_dst.t
@@ -127,7 +127,7 @@ 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";
+ local $ENV{TZ} = "EST5EDT4,M3.2.0/2,M11.1.0/2";
Time::Piece::_tzset();
my $lt = localtime(1373371631); #2013-07-09T12:07:11
cmp_ok(scalar($lt->tzoffset), 'eq', '-14400');