aboutsummaryrefslogtreecommitdiff
path: root/module/datetime.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-09 19:16:22 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-09 19:16:22 +0100
commit989bcefa3c2a98a48bcea2ebf4413add18360af3 (patch)
tree80aae474b7b4f3544261e6b1fb4c4ac218183d8e /module/datetime.scm
parentDeprecate editable-repeat-info, some comments. (diff)
downloadcalp-989bcefa3c2a98a48bcea2ebf4413add18360af3.tar.gz
calp-989bcefa3c2a98a48bcea2ebf4413add18360af3.tar.xz
<datetime> no longer crashes.
Diffstat (limited to 'module/datetime.scm')
-rw-r--r--module/datetime.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/module/datetime.scm b/module/datetime.scm
index c1fae3ce..50817084 100644
--- a/module/datetime.scm
+++ b/module/datetime.scm
@@ -73,7 +73,8 @@
(catch 'misc-error
(lambda () (display (date->string r "#~Y-~m-~d") p))
(lambda (err _ fmt args . rest)
- (format p "BAD~s-~s-~s" (year r) (month r) (day r))))))
+ (format p "#<<date> BAD year=~s month=~s day=~s>"
+ (year r) (month r) (day r))))))
;;; TIME
@@ -91,8 +92,8 @@
(lambda (r p)
(catch 'misc-error
(lambda () (display (time->string r "#~H:~M:~S") p))
- (lambda (err _ fmt args rest)
- (format p "BAD~s:~s:~s"
+ (lambda (err _ fmt args rest)
+ (format p "#<<time> hour=~s minute=~s second=~s>"
(hour r) (minute r) (second r))))))
@@ -124,9 +125,14 @@
(set-record-type-printer!
<datetime>
(lambda (r p)
- (if (and (tz r) (not (string=? "UTC" (tz r))))
- (write (datetime->sexp r) p)
- (display (datetime->string r "#~1T~3~Z") p))))
+ (catch 'misc-error
+ (lambda ()
+ (if (and (tz r) (not (string=? "UTC" (tz r))))
+ (write (datetime->sexp r) p)
+ (display (datetime->string r "#~1T~3~Z") p)))
+ (lambda (err _ fmt args . rest)
+ (format p "#<<datetime> BAD date=~s time=~s tz=~s>"
+ (get-date r) (get-time% r) (tz r))))))