summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/precision.t6
-rw-r--r--t/precision2.t13
2 files changed, 12 insertions, 7 deletions
diff --git a/t/precision.t b/t/precision.t
index 751e1d6..bc01821 100644
--- a/t/precision.t
+++ b/t/precision.t
@@ -10,9 +10,11 @@ else {
plan skip_all => 'Slow test, set $ENV{SLOW_TESTS} to run it';
}
+my $formatter= DateTime::Format::GeekTime->new(2010);
+
for my $i (0..65535) {
my $gkt=sprintf '0x%04X on day 0x000',$i;
- my $dt=DateTime::Format::GeekTime->parse_datetime($gkt);
- my $round_trip=DateTime::Format::GeekTime->format_datetime($dt);
+ my $dt=$formatter->parse_datetime($gkt);
+ my $round_trip=$formatter->format_datetime($dt);
is(substr($round_trip,0,19),$gkt);
}
diff --git a/t/precision2.t b/t/precision2.t
index ef38f2a..abff8b8 100644
--- a/t/precision2.t
+++ b/t/precision2.t
@@ -11,12 +11,15 @@ else {
}
my $dt=DateTime->new(day=>1,month=>1,year=>2010,
- hour=>0,minute=>0,second=>0,
- time_zone=>'UTC');
+ hour=>0,minute=>0,second=>0,
+ time_zone=>'UTC');
+
+my $formatter= DateTime::Format::GeekTime->new(2010);
+
for my $i (0..86399) {
- my $gkt=DateTime::Format::GeekTime->format_datetime($dt);
- my $round_trip=DateTime::Format::GeekTime->parse_datetime($gkt);
+ my $gkt=$formatter->format_datetime($dt);
+ my $round_trip=$formatter->parse_datetime($gkt);
my $diff=$round_trip->subtract_datetime_absolute($dt)->in_units('seconds');
- cmp_ok($diff,'<=',1);
+ cmp_ok($diff,'<=',1,"$round_trip - $dt");
$dt->add(seconds=>1);
}