tlastmod.nim 499 B

1234567891011121314151617181920212223242526
  1. discard """
  2. outputsub: "is newer than"
  3. """
  4. # test the new LastModificationTime() proc
  5. let
  6. file1 = "tests/testdata/data.csv"
  7. file2 = "tests/testdata/doc1.xml"
  8. import
  9. os, times, strutils
  10. proc main() =
  11. var
  12. a, b: Time
  13. a = getLastModificationTime(file1)
  14. b = getLastModificationTime(file2)
  15. writeLine(stdout, $a)
  16. writeLine(stdout, $b)
  17. if a < b:
  18. write(stdout, "$2 is newer than $1\n" % [file1, file2])
  19. else:
  20. write(stdout, "$1 is newer than $2\n" % [file1, file2])
  21. main()