This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
We are no longer slaves to the vagaries of time_t.
[perl5.git] / lib / Time / gmtime.t
CommitLineData
2857d2f7
JH
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
2857d2f7 6
769448c3 7 require "./test.pl";
2857d2f7
JH
8}
9
769448c3 10BEGIN { plan tests => 37; }
2857d2f7 11
769448c3 12BEGIN { use_ok Time::gmtime; }
2857d2f7 13
9b3ca67b
MS
14# Perl has its own gmtime() so it's safe to do negative times.
15for my $time (-2**33, -2**31-1, 0, 2**31-1, 2**33, time) {
769448c3
MS
16 my $gmtime = gmtime $time; # This is the OO gmtime.
17 my @gmtime = CORE::gmtime $time; # This is the gmtime function
2857d2f7 18
769448c3
MS
19 for my $method (qw(sec min hour mday mon year wday yday isdst)) {
20 is $gmtime->$method, shift @gmtime, "gmtime($time)->$method";
21 }
22}