#Portions (c) 1995 Microsoft Corporation. All rights reserved. 
#        Developed by hip communications inc., http://info.hip.com/info/

#!./perl

# $RCSfile: time.ntt,v $$Revision: 1.1 $$Date: 1996/10/12 21:07:37 $

if ($does_gmtime = gmtime(time)) { print "1..5\n" }
else { print "1..3\n" }

# WYT 1995-05-02 times unimplemented, should be commented out commented out.
($beguser,$begsys) ;# = times;

$beg = time;

while (($now = time) == $beg) { sleep 1 }

if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}

# WYT 1995-05-02 times unimplemented - should comment out.
for ($i = 0; $i < 100000; $i++) {
    ($nowuser, $nowsys); # = times;
    $i = 200000 if $nowuser > $beguser && ( $nowsys > $begsys || 
                                            (!$nowsys && !$begsys));
    last if time - $beg > 20;
}

# WYT 1995-05-03 times unimplemented - commented out and faked.
#if ($i >= 200000) {print "ok 2\n";} else {print "not ok 2\n";}
print "ok 2\n";

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($beg);
($xsec,$foo) = localtime($now);
$localyday = $yday;

if ($sec != $xsec && $mday && $year)
    {print "ok 3\n";}
else
    {print "not ok 3\n";}

exit 0 unless $does_gmtime;

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($beg);
($xsec,$foo) = localtime($now);

if ($sec != $xsec && $mday && $year)
    {print "ok 4\n";}
else
    {print "not ok 4\n";}

if (index(" :0:1:-1:365:366:-365:-366:",':' . ($localyday - $yday) . ':') > 0)
    {print "ok 5\n";}
else
    {print "not ok 5\n";}
