Skip to content

ba0f3/timecop.nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()