aboutsummaryrefslogtreecommitdiff
path: root/srfi
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 13:27:06 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 13:27:06 +0100
commit8cb32b73d8d84402b63f94b612357f144c7a69e7 (patch)
treefb6c7756c8359e397214058354624d332407aa32 /srfi
parentMade DTSTART have <time> instead of <date> type. (diff)
downloadcalp-8cb32b73d8d84402b63f94b612357f144c7a69e7.tar.gz
calp-8cb32b73d8d84402b63f94b612357f144c7a69e7.tar.xz
Fix main.
Diffstat (limited to 'srfi')
-rw-r--r--srfi/srfi-19/util.scm29
1 files changed, 15 insertions, 14 deletions
diff --git a/srfi/srfi-19/util.scm b/srfi/srfi-19/util.scm
index ab951ea4..05deb39b 100644
--- a/srfi/srfi-19/util.scm
+++ b/srfi/srfi-19/util.scm
@@ -5,7 +5,8 @@
#:export (copy-date
drop-time! drop-time
localize-date
- date-today?
+ ;; date-today?
+ today?
seconds minutes hours days weeks
date-add
time-add
@@ -52,11 +53,20 @@ transposed to the current timezone. Current timezone gotten from
(time-utc->date (date->time-utc date)
(date-zone-offset (current-date))))
+(define seconds 1)
+(define minutes 60)
+(define hours (* 60 minutes))
+(define days (* 24 hours))
+(define weeks (* 7 days))
+
+(define (time-add time amount unit)
+ (add-duration time (make-time time-duration 0 (* amount unit))))
+
(define (today? time)
- (let* ((now (current-date))
- (then (add-duration time (make-time time-difference 0 (* 24 3600)))))
- (and (time<=? time now)
- (time<=? now then))))
+ (let* ((now (date->time-utc (current-date)))
+ (then (time-add now 1 days)))
+ (and (time<=? now time)
+ (time<=? time then))))
#;
(define (date-today? input-date)
@@ -68,15 +78,6 @@ transposed to the current timezone. Current timezone gotten from
(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 (time-add time amount unit)
- (add-duration time (make-time time-duration 0 (* amount unit))))
-
#;
(define (date-add date amount unit)
(time-utc->date (add-duration (date->time-utc date)