diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2020-02-14 11:02:33 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2020-02-14 11:02:33 +0100 |
commit | 8506e2089497587ec9d5a3502ba0a289f76255a3 (patch) | |
tree | 456048f62526f64cb38e0bda2847c0bcaebaaf40 /module | |
parent | REMOVE datetime-. (diff) | |
download | calp-8506e2089497587ec9d5a3502ba0a289f76255a3.tar.gz calp-8506e2089497587ec9d5a3502ba0a289f76255a3.tar.xz |
Add date-difference.
Diffstat (limited to '')
-rw-r--r-- | module/srfi/srfi-19/alt.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/module/srfi/srfi-19/alt.scm b/module/srfi/srfi-19/alt.scm index 08c41204..e1245a82 100644 --- a/module/srfi/srfi-19/alt.scm +++ b/module/srfi/srfi-19/alt.scm @@ -385,6 +385,7 @@ (date-%% change base) ) +;;; Only use this with extreme caution (define-public (date- base . rest) (fold date-% base rest)) @@ -507,6 +508,8 @@ second: ((@ (srfi srfi-19) date-second) o) ))) +;;; the *-difference procedures takes two actual datetimes. +;;; date- instead takes a date and a delta (but NOT an actual date). (define-public (datetime-difference end start) (let ((t @@ -516,6 +519,10 @@ ((@ (srfi srfi-19) set-time-type!) t (@ (srfi srfi-19) time-utc)) (srfi-19-date->datetime ((@ (srfi srfi-19) time-utc->date) t 0)))) ; TODO tz offset +(define-public (date-difference end start) + (get-date (datetime-difference (datetime date: end) + (datetime date: start)))) + ;;; Parsers for vcomponent usage |