home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / ntcode / ntperlb / t / io / filetime.nt < prev    next >
Encoding:
Text File  |  1995-05-19  |  1002 b   |  51 lines

  1. print "1..4\n";
  2.  
  3. #
  4. # check that $^T has correct initial value
  5. #
  6.  
  7. if ($^T == time) {print "ok 1\n";} else {print "not ok 1\n";};
  8.  
  9. #
  10. # make a temporary file
  11. #
  12.  
  13. open (T, ">foo$$.tmp") || die "can't open foo$$.tmp: $!\n";
  14. close T;
  15.  
  16. #
  17. # check to insure that creation date is negative from program start
  18. # (measured in days since program start)
  19. #
  20. sleep(3);
  21.  
  22. if (-M "foo$$.tmp" < 0) {print "ok 2\n";} else {print "not ok 2\n";};
  23.  
  24. #
  25. # now check that -C and -A are the same as -M
  26. #
  27.  
  28. $m = -M "foo$$.tmp";
  29. $a = -A "foo$$.tmp";
  30. $c = -C "foo$$.tmp";
  31. #print "m: $m,  a: $a,  c: $c\n";
  32.  
  33. if ($c == $m && $a == $m) {print "ok 3\n";} else {print "not ok 3\n";}
  34.  
  35. #
  36. # reopen the file and see if the testing the file handle works
  37. #
  38.  
  39. open (T, "foo$$.tmp") || die "Can't open foo$$.tmp for reading: $!\n";
  40. $m1 = -M T;
  41. $a1 = -A T;
  42. $c1 = -C T;
  43. close T;
  44.  
  45. if ($m == $m1) {print "ok 4\n";} else {print "not ok 4\n";}
  46.  
  47. #print "m1: $m1,  a1: $a1,  c1: $c1\n";
  48.  
  49. unlink "foo$$.tmp";
  50.  
  51.