diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-05 21:26:34 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-05 21:26:34 +0100 |
commit | a0a7e5accc4dc050057ecd99a9c741a65bd7ec5f (patch) | |
tree | 90104d56350210e2205310e203f4cd32b13a4dff | |
parent | Parsing of RRULE works (except some). (diff) | |
download | calp-a0a7e5accc4dc050057ecd99a9c741a65bd7ec5f.tar.gz calp-a0a7e5accc4dc050057ecd99a9c741a65bd7ec5f.tar.xz |
Add date-add to srfi srfi-19 util.
-rw-r--r-- | srfi/srfi-19/util.scm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/srfi/srfi-19/util.scm b/srfi/srfi-19/util.scm index 777f39f2..a020ae55 100644 --- a/srfi/srfi-19/util.scm +++ b/srfi/srfi-19/util.scm @@ -5,7 +5,9 @@ #:export (copy-date drop-time! drop-time localize-date - date-today?)) + date-today? + seconds minutes hours days weeks + date-add)) (define (copy-date date) "Returns a copy of the given date structure" @@ -53,3 +55,13 @@ transposed to the current timezone. Current timezone gotten from (1+ (day then))) (and (%date<=? now input-date) (%date<=? input-date then)))) + +(define seconds 1) +(define minutes 60) +(define hours (* 60 minutes)) +(define days (* 24 hours)) +(define weeks (* 7 days)) + +(define (date-add date amount unit) + (time-utc->date (add-duration (date->time-utc date) + (make-time time-duration 0 (* amount unit))))) |