summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2012-01-28 15:02:48 +0000
committerÆvar Arnfjörð Bjarmason <avar@cpan.org>2012-02-11 22:22:24 +0000
commitd3fdbcf9f781452808340d23242f42ebc1f4f6dc (patch)
tree13ec7e8c03adec5a35451403d22099559c4f4656
parentb6c69f955766b2629a5893b9486f7c2ccb94fc7d (diff)
downloadperl-d3fdbcf9f781452808340d23242f42ebc1f4f6dc.tar.gz
Don't use 1906 to test strptime/mktime because it yields a negative time_t value
-rw-r--r--ext/POSIX/t/time.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/POSIX/t/time.t b/ext/POSIX/t/time.t
index 15605bf991..3d3861066d 100644
--- a/ext/POSIX/t/time.t
+++ b/ext/POSIX/t/time.t
@@ -74,8 +74,9 @@ is_deeply(\@time, [56, 34, 12, 18, 12-1, 2011-1900, 0, 351, 0], 'strptime() all
@time = POSIX::strptime("2011-12-18", "%Y-%m-%d", 1, 23, 4);
is_deeply(\@time, [1, 23, 4, 18, 12-1, 2011-1900, 0, 351, 0], 'strptime() all date fields with passed time');
-@time = POSIX::strptime("12:34:56", "%H:%M:%S", 1, 2, 3, 4, 5, 6);
-is_deeply(\@time, [56, 34, 12, 4, 5, 6, 1, 154, 0], 'strptime() all date fields with passed time');
+# tm_year == 6 => 1906, which is a negative time_t. Lets use 106 as 2006 instead
+@time = POSIX::strptime("12:34:56", "%H:%M:%S", 1, 2, 3, 4, 5, 106);
+is_deeply(\@time, [56, 34, 12, 4, 5, 106, 0, 154, 1], 'strptime() all date fields with passed time');
@time = POSIX::strptime("July 4", "%b %d");
is_deeply([@time[3,4]], [4, 7-1], 'strptime() partial yields correct mday/mon');