From 0867f7baa84e27a1294a62a023829f319620ef70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 9 Jul 2007 16:47:56 +0000 Subject: [PATCH] Changes from arch/CVS synchronization --- ChangeLog | 4 ++++ NEWS | 3 ++- srfi/ChangeLog | 5 +++++ srfi/srfi-19.scm | 6 ++++-- test-suite/ChangeLog | 5 +++++ test-suite/tests/srfi-19.test | 6 ++++++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cf48f397..cab94c708 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-07-09 Ludovic Courtès + + * NEWS: Mention SRFI-19 `date->julian-day' bug fix. + 2007-06-26 Ludovic Courtès * NEWS: Mention fixed memory leaks. diff --git a/NEWS b/NEWS index ec7f7c31c..9c01ccfb6 100644 --- a/NEWS +++ b/NEWS @@ -53,9 +53,10 @@ extensions.) ** `*' returns exact 0 for "(* inexact 0)" This follows what it always did for "(* 0 inexact)". ** SRFI-19: Value returned by `(current-time time-process)' was incorrect +** SRFI-19: `date->julian-day' did not account for timezone offset ** `ttyname' no longer crashes when passed a non-tty argument ** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address -** Small memory leaks have been fixed in `make-fluids' and `add-history' +** Small memory leaks have been fixed in `make-fluid' and `add-history' ** Build problems on Solaris fixed ** Build problems on Mingw fixed diff --git a/srfi/ChangeLog b/srfi/ChangeLog index 2cc0d4d09..0d7c9585b 100644 --- a/srfi/ChangeLog +++ b/srfi/ChangeLog @@ -1,3 +1,8 @@ +2007-07-09 Ludovic Courtès + + * srfi-19.scm (date->julian-day): Take OFFSET into account. + Patch by Jon Wilson . + 2007-05-09 Ludovic Courtès * srfi-19.scm (priv:current-time-process): Removed shadowing diff --git a/srfi/srfi-19.scm b/srfi/srfi-19.scm index 5b94b8808..08302d0c8 100644 --- a/srfi/srfi-19.scm +++ b/srfi/srfi-19.scm @@ -811,10 +811,12 @@ (hour (date-hour date)) (day (date-day date)) (month (date-month date)) - (year (date-year date))) + (year (date-year date)) + (offset (date-zone-offset date))) (+ (priv:encode-julian-day-number day month year) (- 1/2) - (+ (/ (+ (* hour 60 60) + (+ (/ (+ (- offset) + (* hour 60 60) (* minute 60) second (/ nanosecond priv:nano)) diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index e611e73c2..17bae3385 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,3 +1,8 @@ +2007-07-09 Ludovic Courtès + + * tests/srfi-19.test (`time-utc->julian-day' honors timezone): + New. Suggested by Jon Wilson . + 2007-06-26 Ludovic Courtès * tests/socket.test (htonl): Only executed if `htonl' is defined. diff --git a/test-suite/tests/srfi-19.test b/test-suite/tests/srfi-19.test index dd6e608a9..a553ce4f8 100644 --- a/test-suite/tests/srfi-19.test +++ b/test-suite/tests/srfi-19.test @@ -141,6 +141,12 @@ incomplete numerical tower implementation.)" (test-dst time-monotonic->date date->time-monotonic) (test-dst julian-day->date date->julian-day) (test-dst modified-julian-day->date date->modified-julian-day) + + (pass-if "`date->julian-day' honors timezone" + (let ((now (current-date -14400))) + (time=? (date->time-utc (julian-day->date (date->julian-day now))) + (date->time-utc now)))) + (pass-if "string->date respects local DST if no time zone is read" (time=? (date->time-utc (with-tz "EST5EDT"