Something went wrong. Try again.
Nothing to see here yet...
Something went wrong. Try again.
786 B · 39 lines
at main
12345678910111213141516171819202122232425262728293031323334353637383940#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)))