#lang racket/base (require racket/contract/base) (provide (contract-out [now (-> timestamp?)] [clock? (-> any/c boolean?)] [clock-now (-> clock? timestamp?)] [system-clock clock?] [make-clock (-> (-> timestamp?) clock?)] [current-clock (parameter/c clock?)])) (require thunderstorm/libraries/timestamp) ;@---------------------------------------------------------------------------------------------------- (struct clock (now-function) #:constructor-name make-clock) (define (clock-now clock) ((clock-now-function clock))) (define (system-now) (epoch-milliseconds->timestamp (current-inexact-milliseconds))) (define system-clock (make-clock system-now)) (define current-clock (make-parameter system-clock)) (define (now) (clock-now (current-clock)))