12 eval { my $n = localtime 0 };
13 $haslocal = 1 unless $@ && $@ =~ /unimplemented/;
15 skip_all("no localtime") unless $haslocal;
19 my @localtime = CORE::localtime 0; # This is the function localtime.
21 skip_all("localtime failed") unless @localtime;
24 BEGIN { plan tests => 37; }
26 BEGIN { use_ok Time::localtime; }
28 # Since Perl's localtime() still uses the system localtime, don't try
29 # to do negative times. The system might not support it.
30 for my $time (0, 2**31-1, 2**33, time) {
31 my $localtime = localtime $time; # This is the OO localtime.
32 my @localtime = CORE::localtime $time; # This is the localtime function
34 for my $method (qw(sec min hour mday mon year wday yday isdst)) {
35 is $localtime->$method, shift @localtime, "localtime($time)->$method";