Update from y2038
[p5sagit/p5-mst-13.2.git] / lib / Time / gmtime.t
CommitLineData
2857d2f7 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
2857d2f7 6
769448c3 7 require "./test.pl";
2857d2f7 8}
9
b9020a0a 10my(@times, @methods);
11BEGIN {
12 @times = (-2**33, -2**31-1, 0, 2**31-1, 2**33, time);
13 @methods = qw(sec min hour mday mon year wday yday isdst);
14
15 plan tests => (@times * @methods) + 1;
2857d2f7 16
b9020a0a 17 use_ok Time::gmtime;
18}
2857d2f7 19
9b3ca67b 20# Perl has its own gmtime() so it's safe to do negative times.
b9020a0a 21for my $time (@times) {
769448c3 22 my $gmtime = gmtime $time; # This is the OO gmtime.
23 my @gmtime = CORE::gmtime $time; # This is the gmtime function
2857d2f7 24
b9020a0a 25 for my $method (@methods) {
769448c3 26 is $gmtime->$method, shift @gmtime, "gmtime($time)->$method";
27 }
28}