From 6bed5f9d50fa4e23477296b118061228e56f1a98 Mon Sep 17 00:00:00 2001 From: Stelian Ionescu Date: Sat, 23 Aug 2008 16:51:59 +0200 Subject: [PATCH] Add clamp-timeout to base package. Signed-off-by: Stelian Ionescu --- base/pkgdcl.lisp | 2 +- base/time.lisp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/base/pkgdcl.lisp b/base/pkgdcl.lisp index 12a6e43..d64dfcb 100644 --- a/base/pkgdcl.lisp +++ b/base/pkgdcl.lisp @@ -32,7 +32,7 @@ ;; Matching #:multiple-value-case #:flags-case ;; Time - #:decode-timeout #:normalize-timeout)) + #:decode-timeout #:normalize-timeout #:clamp-timeout)) (flet ((gather-external-symbols (&rest packages) (let ((symbols (make-hash-table :test #'eq))) diff --git a/base/time.lisp b/base/time.lisp index 7691937..df38c01 100644 --- a/base/time.lisp +++ b/base/time.lisp @@ -30,3 +30,6 @@ (timeout) "The timeout must be non-negative: ~A" timeout) (coerce timeout 'timeout)) + +(defun clamp-timeout (timeout &optional min max) + (clamp timeout (if min (max min 0) 0) (or max most-positive-fixnum))) -- 2.11.4.GIT