tmonotimes.nim 357 B

123456789101112131415161718192021
  1. discard """
  2. targets: "c js"
  3. """
  4. import std/[monotimes, times]
  5. let d = initDuration(nanoseconds = 10)
  6. let t1 = getMonoTime()
  7. let t2 = t1 + d
  8. doAssert t2 - t1 == d
  9. doAssert t1 == t1
  10. doAssert t1 != t2
  11. doAssert t2 - d == t1
  12. doAssert t1 < t2
  13. doAssert t1 <= t2
  14. doAssert t1 <= t1
  15. doAssert not(t2 < t1)
  16. doAssert t1 < high(MonoTime)
  17. doAssert low(MonoTime) < t1