summaryrefslogtreecommitdiff
path: root/t/precision2.t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2017-06-21 21:54:00 +0100
committerdakkar <dakkar@thenautilus.net>2017-06-21 21:54:00 +0100
commit65616d2ea5f7469103e660cd3a17cb2c1c065b1e (patch)
tree699b88e19316cc9cb90eb345a721028e51ec3e87 /t/precision2.t
parentchangelog (diff)
downloadDateTime-Format-GeekTime-65616d2ea5f7469103e660cd3a17cb2c1c065b1e.tar.gz
DateTime-Format-GeekTime-65616d2ea5f7469103e660cd3a17cb2c1c065b1e.tar.bz2
DateTime-Format-GeekTime-65616d2ea5f7469103e660cd3a17cb2c1c065b1e.zip
fix slow tests
precision2.t only worked in 2010…
Diffstat (limited to 't/precision2.t')
-rw-r--r--t/precision2.t13
1 files changed, 8 insertions, 5 deletions
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);
}