perl 1.0 patch 1: Portability bugs and one possible SIGSEGV
[p5sagit/p5-mst-13.2.git] / t / op.time
CommitLineData
8d063cd8 1#!./perl
2
3# $Header: op.time,v 1.0 87/12/18 13:14:33 root Exp $
4
5print "1..5\n";
6
7($beguser,$begsys) = times;
8
9$beg = time;
10
11while (($now = time) == $beg) {}
12
13if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
14
15for ($i = 0; $i < 100000; $i++) {
16 ($nowuser, $nowsys) = times;
17 $i = 200000 if $nowuser > $beguser && $nowsys > $begsys;
18 last if time - $beg > 20;
19}
20
21if ($i >= 200000) {print "ok 2\n";} else {print "not ok 2\n";}
22
23($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($beg);
24($xsec,$foo) = localtime($now);
25$localyday = $yday;
26
27if ($sec != $xsec && $yday && $wday && $year)
28 {print "ok 3\n";}
29else
30 {print "not ok 3\n";}
31
32($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($beg);
33($xsec,$foo) = localtime($now);
34
35if ($sec != $xsec && $yday && $wday && $year)
36 {print "ok 4\n";}
37else
38 {print "not ok 4\n";}
39
40if (index(" :0:1:-1:365:366:-365:-366:",':' . ($localyday - $yday) . ':') > 0)
41 {print "ok 5\n";}
42else
43 {print "not ok 5\n";}