From 86c52699065222d5fcec0d042acd402e8bb57f34 Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 8 Mar 2010 18:10:57 +0000 Subject: tests, docs, and it works --- t/precision2.t | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 t/precision2.t (limited to 't/precision2.t') diff --git a/t/precision2.t b/t/precision2.t new file mode 100644 index 0000000..ef38f2a --- /dev/null +++ b/t/precision2.t @@ -0,0 +1,22 @@ +#!perl +use Test::More; +use DateTime; +use DateTime::Format::GeekTime; + +if ($ENV{SLOW_TESTS}) { + plan tests=>86400; +} +else { + plan skip_all => 'Slow test, set $ENV{SLOW_TESTS} to run it'; +} + +my $dt=DateTime->new(day=>1,month=>1,year=>2010, + hour=>0,minute=>0,second=>0, + time_zone=>'UTC'); +for my $i (0..86399) { + my $gkt=DateTime::Format::GeekTime->format_datetime($dt); + my $round_trip=DateTime::Format::GeekTime->parse_datetime($gkt); + my $diff=$round_trip->subtract_datetime_absolute($dt)->in_units('seconds'); + cmp_ok($diff,'<=',1); + $dt->add(seconds=>1); +} -- cgit v1.2.3