File: gmtime.t

package info (click to toggle)
perl 5.8.8-7etch6
  • links: PTS
  • area: main
  • in suites: etch
  • size: 60,396 kB
  • ctags: 33,629
  • sloc: perl: 199,713; ansic: 160,511; sh: 33,095; pascal: 8,270; lisp: 6,121; makefile: 2,373; cpp: 2,035; yacc: 1,047; java: 23
file content (57 lines) | stat: -rwxr-xr-x 1,092 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!./perl

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
}

BEGIN {
    our $hasgm;
    eval { my $n = gmtime 0 };
    $hasgm = 1 unless $@ && $@ =~ /unimplemented/;
    unless ($hasgm) { print "1..0 # Skip: no gmtime\n"; exit 0 }
}

BEGIN {
    our @gmtime = gmtime 0; # This is the function gmtime.
    unless (@gmtime) { print "1..0 # Skip: gmtime failed\n"; exit 0 }
}

print "1..10\n";

use Time::gmtime;

print "ok 1\n";

my $gmtime = gmtime 0 ; # This is the OO gmtime.

print "not " unless $gmtime->sec   == $gmtime[0];
print "ok 2\n";

print "not " unless $gmtime->min   == $gmtime[1];
print "ok 3\n";

print "not " unless $gmtime->hour  == $gmtime[2];
print "ok 4\n";

print "not " unless $gmtime->mday  == $gmtime[3];
print "ok 5\n";

print "not " unless $gmtime->mon   == $gmtime[4];
print "ok 6\n";

print "not " unless $gmtime->year  == $gmtime[5];
print "ok 7\n";

print "not " unless $gmtime->wday  == $gmtime[6];
print "ok 8\n";

print "not " unless $gmtime->yday  == $gmtime[7];
print "ok 9\n";

print "not " unless $gmtime->isdst == $gmtime[8];
print "ok 10\n";