perl 5.0 alpha 2
[p5sagit/p5-mst-13.2.git] / t / op / time.t
1 #!./perl
2
3 # $RCSfile: time.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:32 $
4
5 print "1..5\n";
6
7 ($beguser,$begsys) = times;
8
9 $beg = time;
10
11 while (($now = time) == $beg) {}
12
13 if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
14
15 for ($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
21 if ($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
27 if ($sec != $xsec && $mday && $year)
28     {print "ok 3\n";}
29 else
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
35 if ($sec != $xsec && $mday && $year)
36     {print "ok 4\n";}
37 else
38     {print "not ok 4\n";}
39
40 if (index(" :0:1:-1:365:366:-365:-366:",':' . ($localyday - $yday) . ':') > 0)
41     {print "ok 5\n";}
42 else
43     {print "not ok 5\n";}