aboutsummaryrefslogtreecommitdiff
path: root/guile
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-05-22 15:02:31 +0200
committerThomas White <taw@physics.org>2021-05-22 15:02:31 +0200
commitf537b902114e5c8d7ee00c924e91808098b2307a (patch)
tree56fdcb01f8f8c7e0ee2e1bcd308ef8ab019f0f09 /guile
parent0447be4186ef500a439293442519f32ee9282da8 (diff)
Add clock expiration times
Diffstat (limited to 'guile')
-rw-r--r--guile/starlet/clock.scm17
1 files changed, 15 insertions, 2 deletions
diff --git a/guile/starlet/clock.scm b/guile/starlet/clock.scm
index 29782a0..6c11936 100644
--- a/guile/starlet/clock.scm
+++ b/guile/starlet/clock.scm
@@ -26,6 +26,7 @@
stop-clock!
start-clock!
reverse-clock!
+ clock-expired?
<starlet-delayed-clock>
make-delayed-clock
@@ -65,14 +66,26 @@
#:getter clock-stopped?
#:setter set-clock-stopped!)
+ (expiration-time
+ #:init-value #f
+ #:init-keyword #:expiration-time
+ #:getter expiration-time)
+
(reversed
#:init-value #f
#:getter clock-reversed?
#:setter set-clock-reversed!))
-(define (make-clock)
- (make <starlet-clock>))
+(define* (make-clock
+ #:key (expiration-time #f))
+ (make <starlet-clock>
+ #:expiration-time expiration-time))
+
+
+(define (clock-expired? clock)
+ (> (elapsed-time clock)
+ (expiration-time clock)))
(define-method (elapsed-time (clock <starlet-clock>))