summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-03-17 15:13:03 +0530
committerArun Isaac2022-03-18 16:23:32 +0530
commitba3d2c9705ab58bb35eaad3d49c8550289806015 (patch)
tree9af16325b6bed24283287a9175b2eb3c87ca57de
parentbce55ba68682545c5f13d00ed9bdf3917c7c4487 (diff)
downloadtissue-ba3d2c9705ab58bb35eaad3d49c8550289806015.tar.gz
tissue-ba3d2c9705ab58bb35eaad3d49c8550289806015.tar.lz
tissue-ba3d2c9705ab58bb35eaad3d49c8550289806015.zip
issue: Use SRFI-19 dates.
* tissue/issue.scm: Use (srfi srfi-19). (unix-time->date): New function. (file-details): Convert date fields created-date and last-updated-date to SRFI-19. (issues): Use SRFI-19 time comparison in sort comparator.
-rw-r--r--tissue/issue.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/tissue/issue.scm b/tissue/issue.scm
index 95edf4e..561b762 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -22,6 +22,7 @@
#:use-module (rnrs io ports)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-171)
#:use-module (ice-9 match)
@@ -112,6 +113,11 @@ return #f."
'()
(comma-split (remove-prefix "* " line)))))
+(define (unix-time->date timestamp)
+ "Convert unix TIMESTAMP to an SRFI-19 date object."
+ (time-monotonic->date
+ (make-time time-monotonic 0 timestamp)))
+
(define (file-details file)
"Return a hashtable of details extracted from gemini FILE."
(let ((result (make-eq-hashtable)))
@@ -193,13 +199,13 @@ return #f."
(hashtable-set! result 'last-updater
(assq-ref alist 'author))
(hashtable-set! result 'last-updated-date
- (assq-ref alist 'author-date))
+ (unix-time->date (assq-ref alist 'author-date)))
(hashtable-set! result 'last-updated-relative-date
(assq-ref alist 'author-relative-date)))
(hashtable-set! result 'creator
(assq-ref alist 'author))
(hashtable-set! result 'created-date
- (assq-ref alist 'author-date))
+ (unix-time->date (assq-ref alist 'author-date)))
(hashtable-set! result 'created-relative-date
(assq-ref alist 'author-relative-date)))))))
rcount get-line port)))
@@ -258,5 +264,5 @@ return #f."
rcons get-line port))
"git" "ls-files")
(lambda (issue1 issue2)
- (< (issue-created-date issue1)
- (issue-created-date issue2)))))))
+ (time<? (date->time-monotonic (issue-created-date issue1))
+ (date->time-monotonic (issue-created-date issue2))))))))