tmonotimes.nim 411 B

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