home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / perl / os2perl / time.t < prev    next >
Text File  |  1991-04-12  |  1KB  |  44 lines

  1. #!./perl
  2.  
  3. # $Header: time.t,v 4.0 91/03/20 01:55:09 lwall Locked $
  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";}
  44.