fix date*->seconds handling of nanoseconds field

This commit is contained in:
Ryan Culpepper 2015-08-22 19:33:57 -04:00
parent 66df8a2b9f
commit 70ab4cfb12
2 changed files with 6 additions and 2 deletions

View File

@ -43,7 +43,7 @@
(date-day d) (date-month d) (date-year d)
(date-week-day d) (date-year-day d) (date-dst? d)
(date-time-zone-offset d)
62500
62500000
"MDT")])
(define (test-string fmt time? result)
(test (parameterize ([date-display-format fmt])
@ -113,4 +113,8 @@
(struct-copy date* (seconds->date (current-seconds))
[hour #:parent date 5]))
(let ([d ;; 2015-08-22T12:34:56.789000000Z
(date* 56 34 12 22 08 2015 6 233 #f 0 789000000 "UTC")])
(test 789/1000 - (date*->seconds d) (date->seconds d)))
(report-errs)

View File

@ -242,7 +242,7 @@
(define (date*->seconds date [local-time? #t])
(define s (date->seconds date local-time?))
(if (date*? date)
(+ s (/ (date*-nanosecond date) 1000000))
(+ s (/ (date*-nanosecond date) #e1e9))
s))
(define (find-seconds sec min hour day month year [local-time? #t])