diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-13 16:33:17 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-06-13 16:33:17 +0200 |
commit | 37ceda152f989657df54e4b09b6c43bd75267413 (patch) | |
tree | 046035b153e98ca5cfdc4fd644c477809f3fe9a7 /module/datetime.scm | |
parent | Update weekday-list documentation. (diff) | |
download | calp-37ceda152f989657df54e4b09b6c43bd75267413.tar.gz calp-37ceda152f989657df54e4b09b6c43bd75267413.tar.xz |
Change write-form of <datetime>.
Diffstat (limited to '')
-rw-r--r-- | module/datetime.scm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/module/datetime.scm b/module/datetime.scm index 8591f6f9..14b6f53c 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -38,6 +38,10 @@ date? (year year) (month month) (day day)) +;;; NOTE all these printers would benefit from using datetime->string, +;;; that however is currently in the (datetime util) module, which leads +;;; to a dependency cycle. + (set-record-type-printer! <date> (lambda (r p) @@ -85,11 +89,19 @@ (set-record-type-printer! <datetime> (lambda (r p) - (write `(datetime date: ,(get-date r) - time: ,(get-time% r) - ,@(awhen (tz r) - `(tz: ,it))) - p))) + (if (tz r) + (write `(datetime date: ,(get-date r) + time: ,(get-time% r) + tz: ,(tz r)) + p) + (display + (string-append + (with-output-to-string (lambda () (write (get-date r)))) + "T" + (string-drop + (with-output-to-string (lambda () (write (get-time% r)))) + 1)) + p)))) (export get-date) (define-public (get-timezone datetime) |