summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/atom.scm9
-rw-r--r--src/dates.scm12
2 files changed, 13 insertions, 8 deletions
diff --git a/src/atom.scm b/src/atom.scm
index 229c032..fe4b9e7 100644
--- a/src/atom.scm
+++ b/src/atom.scm
@@ -3,7 +3,6 @@
#:use-module (src dates)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
- #:use-module (srfi srfi-19)
#:use-module (sxml simple)
#:use-module (ice-9 binary-ports)
#:use-module (rnrs bytevectors)
@@ -58,10 +57,6 @@
(email person-email)
(uri person-uri))
-(define zero-date (string/ISO->date "1970-01-01"))
-(define (newest a b) (if (time>? (date->time-utc a) (date->time-utc b)) a b))
-(define (find-newest dates) (reduce newest zero-date dates))
-
(define* (append-feed-entry! feed entry)
(let ((entries (feed-entries feed)))
(set-entry-id! entry (string-append
@@ -89,8 +84,8 @@
(define* (entry #:key (title "")
(id #f)
- (published zero-date)
- (updated zero-date)
+ (published unix-date)
+ (updated unix-date)
(authors '())
(summary-html '())
(content-html '())
diff --git a/src/dates.scm b/src/dates.scm
index edbac1c..2bbb977 100644
--- a/src/dates.scm
+++ b/src/dates.scm
@@ -1,10 +1,20 @@
(define-module (src dates)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:export (string/ISO->date
- date->string/RFC3339))
+ date->string/RFC3339
+ unix-date
+ newest
+ find-newest))
(define (string/ISO->date string)
(string->date string "~Y-~m-~d"))
(define (date->string/RFC3339 date)
(date->string date "~4"))
+
+(define unix-date (string/ISO->date "1970-01-01"))
+
+(define (newest a b) (if (time>? (date->time-utc a) (date->time-utc b)) a b))
+
+(define (find-newest dates) (reduce newest unix-date dates))