timecop

Time travelling for Nim

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install timecop
choosenim install timecop
git clone https://github.com/ba0f3/timecop.nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
timecop - - - - - - -

Source

Repository https://github.com/ba0f3/timecop.nim
Homepage https://github.com/ba0f3/timecop.nim
Registry Source nimble_official

README

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