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