1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

SRFI-19: Rename 'tai-epoch-in-jd' to 'utc-epoch-in-jd'.

* module/srfi/srfi-19.scm: Rename 'tai-epoch-in-jd' to
'utc-epoch-in-jd', to reflect its actual meaning and usage.
This commit is contained in:
Mark H Weaver 2018-10-24 03:14:49 -04:00
parent a17b727963
commit 2980b66f6f

View file

@ -156,13 +156,13 @@
(define iso-8601-date-time-format "~Y-~m-~dT~H:~M:~S~z") (define iso-8601-date-time-format "~Y-~m-~dT~H:~M:~S~z")
;;-- Miscellaneous Constants. ;;-- Miscellaneous Constants.
;;-- only the tai-epoch-in-jd might need changing if ;;-- only the utc-epoch-in-jd might need changing if
;; a different epoch is used. ;; a different epoch is used.
(define nano 1000000000) ; nanoseconds in a second (define nano 1000000000) ; nanoseconds in a second
(define sid 86400) ; seconds in a day (define sid 86400) ; seconds in a day
(define sihd 43200) ; seconds in a half day (define sihd 43200) ; seconds in a half day
(define tai-epoch-in-jd 4881175/2) ; julian day number for 'the epoch' (define utc-epoch-in-jd 4881175/2) ; julian day number for 'the epoch'
;; FIXME: should this be something other than misc-error? ;; FIXME: should this be something other than misc-error?
(define (time-error caller type value) (define (time-error caller type value)
@ -181,7 +181,7 @@
(define (read-tai-utc-data filename) (define (read-tai-utc-data filename)
(define (convert-jd jd) (define (convert-jd jd)
(* (- (inexact->exact jd) tai-epoch-in-jd) sid)) (* (- (inexact->exact jd) utc-epoch-in-jd) sid))
(define (convert-sec sec) (define (convert-sec sec)
(inexact->exact sec)) (inexact->exact sec))
(let ((port (open-input-file filename)) (let ((port (open-input-file filename))
@ -611,7 +611,7 @@
(define (time->julian-day-number seconds tz-offset) (define (time->julian-day-number seconds tz-offset)
(+ (/ (+ seconds tz-offset sihd) (+ (/ (+ seconds tz-offset sihd)
sid) sid)
tai-epoch-in-jd)) utc-epoch-in-jd))
(define (tai-before-leap-second? second) (define (tai-before-leap-second? second)
(any (lambda (x) (any (lambda (x)
@ -669,7 +669,7 @@
(let* ((jdays (- (encode-julian-day-number (date-day date) (let* ((jdays (- (encode-julian-day-number (date-day date)
(date-month date) (date-month date)
(date-year date)) (date-year date))
tai-epoch-in-jd)) utc-epoch-in-jd))
;; jdays is an integer plus 1/2, ;; jdays is an integer plus 1/2,
(jdays-1/2 (inexact->exact (- jdays 1/2)))) (jdays-1/2 (inexact->exact (- jdays 1/2))))
(make-time (make-time
@ -798,7 +798,7 @@
(time-error 'time-utc->julian-day 'incompatible-time-types time)) (time-error 'time-utc->julian-day 'incompatible-time-types time))
(+ (/ (+ (time-second time) (/ (time-nanosecond time) nano)) (+ (/ (+ (time-second time) (/ (time-nanosecond time) nano))
sid) sid)
tai-epoch-in-jd)) utc-epoch-in-jd))
(define (time-utc->modified-julian-day time) (define (time-utc->modified-julian-day time)
(- (time-utc->julian-day time) (- (time-utc->julian-day time)
@ -810,7 +810,7 @@
(+ (/ (+ (tai->utc (time-second time)) (+ (/ (+ (tai->utc (time-second time))
(/ (time-nanosecond time) nano)) (/ (time-nanosecond time) nano))
sid) sid)
tai-epoch-in-jd)) utc-epoch-in-jd))
(define (time-tai->modified-julian-day time) (define (time-tai->modified-julian-day time)
(- (time-tai->julian-day time) (- (time-tai->julian-day time)
@ -823,14 +823,14 @@
(+ (/ (+ (tai->utc (time-second time)) (+ (/ (+ (tai->utc (time-second time))
(/ (time-nanosecond time) nano)) (/ (time-nanosecond time) nano))
sid) sid)
tai-epoch-in-jd)) utc-epoch-in-jd))
(define (time-monotonic->modified-julian-day time) (define (time-monotonic->modified-julian-day time)
(- (time-monotonic->julian-day time) (- (time-monotonic->julian-day time)
4800001/2)) 4800001/2))
(define (julian-day->time-utc jdn) (define (julian-day->time-utc jdn)
(let ((secs (* sid (- jdn tai-epoch-in-jd)))) (let ((secs (* sid (- jdn utc-epoch-in-jd))))
(receive (seconds parts) (receive (seconds parts)
(split-real secs) (split-real secs)
(make-time time-utc (make-time time-utc