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