Commit | Line | Data |
2857d2f7 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | } |
7 | |
8 | BEGIN { |
9 | our $haslocal; |
10 | eval { my $n = localtime 0 }; |
11 | $haslocal = 1 unless $@ && $@ =~ /unimplemented/; |
12 | unless ($haslocal) { print "1..0 # Skip: no localtime\n"; exit 0 } |
13 | } |
14 | |
15 | BEGIN { |
16 | our @localtime = localtime 0; # This is the function localtime. |
17 | unless (@localtime) { print "1..0 # Skip: localtime failed\n"; exit 0 } |
18 | } |
19 | |
20 | print "1..10\n"; |
21 | |
22 | use Time::localtime; |
23 | |
24 | print "ok 1\n"; |
25 | |
26 | my $localtime = localtime 0 ; # This is the OO localtime. |
27 | |
28 | print "not " unless $localtime->sec == $localtime[0]; |
29 | print "ok 2\n"; |
30 | |
31 | print "not " unless $localtime->min == $localtime[1]; |
32 | print "ok 3\n"; |
33 | |
34 | print "not " unless $localtime->hour == $localtime[2]; |
35 | print "ok 4\n"; |
36 | |
37 | print "not " unless $localtime->mday == $localtime[3]; |
38 | print "ok 5\n"; |
39 | |
40 | print "not " unless $localtime->mon == $localtime[4]; |
41 | print "ok 6\n"; |
42 | |
43 | print "not " unless $localtime->year == $localtime[5]; |
44 | print "ok 7\n"; |
45 | |
46 | print "not " unless $localtime->wday == $localtime[6]; |
47 | print "ok 8\n"; |
48 | |
49 | print "not " unless $localtime->yday == $localtime[7]; |
50 | print "ok 9\n"; |
51 | |
52 | print "not " unless $localtime->isdst == $localtime[8]; |
53 | print "ok 10\n"; |
54 | |
55 | |
56 | |
57 | |