The generated zone file is slightly different (vs the CPAN version):
----------
--- lib/DateTime/TimeZone/Pacific/Tongatapu.pm 2016-11-03 03:05:04.000000000 +0000
+++ /usr/src/datetime-timezone-build/DateTime-TimeZone-2.07/lib/DateTime/TimeZone/Pacific/Tongatapu.pm2016-11-07 22:33:35.053696907 +0000
@@ -3,7 +3,7 @@
# DateTime::TimeZone module distribution in the tools/ directory
#
-# Generated from /tmp/kLJgvD2F1Z/australasia. Olson data version 2016i
+# Generated from /tmp/mV47OZJj0J/australasia. Olson data version 2016i
#
# Do not edit this file directly.
#
@@ -365,17 +365,6 @@
my $rules = [
bless( {
- 'at' => '2:00',
- 'from' => '2016',
- 'in' => 'Nov',
- 'letter' => 'S',
- 'name' => 'Tonga',
- 'offset_from_std' => 3600,
- 'on' => 'Sun>=1',
- 'save' => '1:00',
- 'to' => 'max'
- }, 'DateTime::TimeZone::OlsonDB::Rule' ),
- bless( {
'at' => '3:00',
'from' => '2017',
'in' => 'Jan',
@@ -385,6 +374,17 @@
'on' => 'Sun>=15',
'save' => '0',
'to' => 'max'
+ }, 'DateTime::TimeZone::OlsonDB::Rule' ),
+ bless( {
+ 'at' => '2:00',
+ 'from' => '2016',
+ 'in' => 'Nov',
+ 'letter' => 'S',
+ 'name' => 'Tonga',
+ 'offset_from_std' => 3600,
+ 'on' => 'Sun>=1',
+ 'save' => '1:00',
+ 'to' => 'max'
}, 'DateTime::TimeZone::OlsonDB::Rule' )
]
;
----------
I wondered if it might be the ordering at fault, but reordering doesn't fix it.
I've been looking at the actual test output, and I think perhaps the generated test is wrong? I'm very new at reading this, but:
Rule Tonga 2016 max - Nov Sun>=1 2:00 1:00 S
Rule Tonga 2017 max - Jan Sun>=15 3:00 0 -
Does that mean a transition from DST->not-DST on the Sunday mid-Jan? In 2038 that would be the 17th, so these two tests on the 19th, one second apart, should actually both be non-DST?
{
my $dt = DateTime->new( year => 2038, month => 1, day => 19, hour => 3, minute => 14, second => 6,
time_zone => 'UTC',
);
$dt->set_time_zone( 'Pacific/Tongatapu' );
is( $dt->year, 2038, 'local year should be 2038 (2038-01-19 17:14:06)' );
is( $dt->month, 1, 'local month should be 1 (2038-01-19 17:14:06)' );
is( $dt->day, 19, 'local day should be 19 (2038-01-19 17:14:06)' );
is( $dt->hour, 17, 'local hour should be 17 (2038-01-19 17:14:06)' );
is( $dt->minute, 14, 'local minute should be 14 (2038-01-19 17:14:06)' );
is( $dt->second, 6, 'local second should be 6 (2038-01-19 17:14:06)' );
is( $dt->is_dst, 1, 'is_dst should be 1 (2038-01-19 17:14:06)' );
is( $dt->offset, 50400, 'offset should be 50400 (2038-01-19 17:14:06)' );
is( $dt->time_zone_short_name, '+14', 'short name should be +14 (2038-01-19 17:14:06)' );
}
{
my $dt = DateTime->new( year => 2038, month => 1, day => 19, hour => 3, minute => 14, second => 7,
time_zone => 'UTC',
);
$dt->set_time_zone( 'Pacific/Tongatapu' );
is( $dt->year, 2038, 'local year should be 2038 (2038-01-19 16:14:07)' );
is( $dt->month, 1, 'local month should be 1 (2038-01-19 16:14:07)' );
is( $dt->day, 19, 'local day should be 19 (2038-01-19 16:14:07)' );
is( $dt->hour, 16, 'local hour should be 16 (2038-01-19 16:14:07)' );
is( $dt->minute, 14, 'local minute should be 14 (2038-01-19 16:14:07)' );
is( $dt->second, 7, 'local second should be 7 (2038-01-19 16:14:07)' );
is( $dt->is_dst, 0, 'is_dst should be 0 (2038-01-19 16:14:07)' );
is( $dt->offset, 46800, 'offset should be 46800 (2038-01-19 16:14:07)' );
is( $dt->time_zone_short_name, '+13', 'short name should be +13 (2038-01-19 16:14:07)' );
}
I'm still reading about how the tests are generated. I'll add more here if I find anything interesting.