Skip to content

Commit

Permalink
Allow for overriding current time via special variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ak-coram committed Jul 11, 2023
1 parent 6264577 commit 1c394f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clock.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

(in-package #:ginkgo-time)

(defparameter *clock-now* nil)
(defparameter *clock-now-function* nil)

(defun clock-now ()
(trivial-clock:now))
(cond
(*clock-now* (values-list *clock-now*))
(*clock-now-function* (funcall *clock-now-function*))
(t (trivial-clock:now))))
2 changes: 2 additions & 0 deletions package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#:chrono-unit-duration

;; clock.lisp
#:*clock-now*
#:*clock-now-function*
#:clock-now

;; instant.lisp
Expand Down

0 comments on commit 1c394f2

Please sign in to comment.