No description
Find a file
2021-10-01 07:51:54 +07:00
.github Create FUNDING.yml 2021-10-01 07:51:54 +07:00
src fixes for recent Nim version 2020-12-20 15:36:37 +07:00
tests implement freezeAt and travelTo 2018-07-19 00:05:12 +07:00
README.md add readme 2018-07-19 00:22:19 +07:00
timecop.nimble fixes for recent Nim version 2020-12-20 15:36:37 +07:00

timecop

nimble install timecop

timecop requires subhook module and not production ready

timecop provides two helpers freezeAt and travelTo template, that will helps you do unittest on specified time

Usage

import times, timecop

freezeAt now():
  # time never changes inside this code block
  echo now()
  sleep(10_000)
  echo now()  

travelTo now() - 1.days:
  # time will starts on yesterday, and continue running
  echo now()
  sleep(10_000)
  echo now()