guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI-19 bug: date->julian-day not inverse of julian-day->date


From: Jon Wilson
Subject: Re: SRFI-19 bug: date->julian-day not inverse of julian-day->date
Date: Wed, 27 Jun 2007 17:42:21 -0400
User-agent: Thunderbird 1.5.0.12 (X11/20070604)

Hi,
Yep. This was a bug which was apparently fixed in the srfi-19 reference implementation quite some time ago. However, the current reference implementation for date->julian-day doesn't work either. Anyway, I've made a change to my working copy of CVS HEAD, and attached is output from cvs diff.
Regards,
Jon

Jon Wilson wrote:
Hi,
Take a gander:

guile> (date->string (current-date))
"Wed Jun 27 16:39:42-0400 2007"
guile> (date->string (julian-day->date (date->julian-day (current-date))))
"Wed Jun 27 12:39:43-0400 2007"

Offset by four hours from one another. Of course, the four hours comes from the -0400 time zone. But clearly one of the two functions is taking the time zone into account in a different manner from the other function, leading to this discrepancy.

Similarly:

guile> (exact->inexact (current-julian-day ))
2454279.36203873
guile> (exact->inexact (date->julian-day (julian-day->date (current-julian-day ))))
2454279.19553665

Nothing changes if I add the timezone specification to the julian-dat->date function: (julian-day->date X -14400). I'm going to go look at SRFI-19, and see if I can figure out if this is really a bug or a design flaw. If it is a bug, I'll take a look at fixing it and submitting a patch soon.

Regards,
Jon


_______________________________________________
Guile-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/guile-user

Index: srfi-19.scm
===================================================================
RCS file: /sources/guile/guile/guile-core/srfi/srfi-19.scm,v
retrieving revision 1.27
diff -r1.27 srfi-19.scm
814c814,815
<         (year (date-year date)))
---
>         (year (date-year date))
>         (offset (date-zone-offset date)))
817c818,819
<        (+ (/ (+ (* hour 60 60)
---
>        (+ (/ (+ (- offset)
>                 (* hour 60 60)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]