* [bug #29575] SRFI-19 conversion issue
@ 2010-04-16 9:08 anonymous
2010-04-16 9:09 ` anonymous
0 siblings, 1 reply; 7+ messages in thread
From: anonymous @ 2010-04-16 9:08 UTC (permalink / raw)
To: bug-guile
URL:
<http://savannah.gnu.org/bugs/?29575>
Summary: SRFI-19 conversion issue
Project: Guile
Submitted by: None
Submitted on: Fri 16 Apr 2010 09:08:21 AM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Using SRFI-19, converting from string->date->time-utc, adding a duration, and
converting back time->utc->date->string returns an incorrect result, but
apparently on only specific dates.
Code to reproduce:
(use-modules (srfi srfi-19))
(define one-day-duration
(time-difference (date->time-utc (string->date "20100102" "~Y~m~d"))
(date->time-utc (string->date "20100101" "~Y~m~d"))))
(define +day
(lambda (yyyymmdd)
"Add one day to date string"
(date->string
(time-utc->date
(add-duration (date->time-utc (string->date yyyymmdd "~Y~m~d"))
one-day-duration))
"~Y~m~d")))
(+day "20091102")
=> "20091103" Correct.
(+day "20091101")
=> "20091101" ERROR!
(+day "20081101")
=> "20081102" Correct.
(+day "20081102")
=> "20081102" ERROR!
(+day "20071103")
=> "20071104" Correct.
(+day "20071104")
=> "20071104" ERROR!
And so forth.
From what I have seen, only the beginning of November seems to be the issue
-- I have used these functions to get every date for 2007, 2008 and 2009, and
those were the only issues I''ve seen so far.
HTH.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29575>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug #29575] SRFI-19 conversion issue
2010-04-16 9:08 [bug #29575] SRFI-19 conversion issue anonymous
@ 2010-04-16 9:09 ` anonymous
2010-04-16 11:52 ` anonymous
0 siblings, 1 reply; 7+ messages in thread
From: anonymous @ 2010-04-16 9:09 UTC (permalink / raw)
To: bug-guile
Follow-up Comment #1, bug #29575 (project guile):
Sorry -- Error discovered using Debian Lenny, Guile version 1.8.5 via
apt-get.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29575>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug #29575] SRFI-19 conversion issue
2010-04-16 9:09 ` anonymous
@ 2010-04-16 11:52 ` anonymous
2010-04-16 13:51 ` Ludovic Courtès
0 siblings, 1 reply; 7+ messages in thread
From: anonymous @ 2010-04-16 11:52 UTC (permalink / raw)
To: bug-guile
Follow-up Comment #2, bug #29575 (project guile):
Furthermore, there doesn't appear to be an issue for 2010 or 2006, so just
2007-2009.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29575>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug #29575] SRFI-19 conversion issue
2010-04-16 11:52 ` anonymous
@ 2010-04-16 13:51 ` Ludovic Courtès
2011-02-13 13:57 ` Ludovic Courtès
0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2010-04-16 13:51 UTC (permalink / raw)
To: Ludovic Courtès, bug-guile
Follow-up Comment #3, bug #29575 (project guile):
For the record I can't reproduce it with 1.9.10:
#v+
scheme@(guile-user)> (use-modules (srfi srfi-19))
scheme@(guile-user)>
scheme@(guile-user)> (define one-day-duration
... (time-difference (date->time-utc (string->date "20100102" "~Y~m~d"))
... (date->time-utc (string->date "20100101" "~Y~m~d"))))
scheme@(guile-user)>
scheme@(guile-user)> (define +day
... (lambda (yyyymmdd)
... "Add one day to date string"
... (date->string
... (time-utc->date
... (add-duration (date->time-utc (string->date yyyymmdd "~Y~m~d"))
... one-day-duration))
... "~Y~m~d")))
scheme@(guile-user)>
scheme@(guile-user)>
scheme@(guile-user)> (+day "20091102")
$1 = "20091103"
scheme@(guile-user)> (+day "20091101")
$2 = "20091102"
scheme@(guile-user)> (+day "20081102")
$3 = "20081103"
scheme@(guile-user)> (+day "20071104")
$4 = "20071105"
scheme@(guile-user)> (setlocale LC_ALL)
$5 =
"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
scheme@(guile-user)> (getenv "TZ")
$6 = "Europe/Paris"
#v-
Could it be related to your timezone settings or something?
Ludo'.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?29575>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-10-22 15:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16 9:08 [bug #29575] SRFI-19 conversion issue anonymous
2010-04-16 9:09 ` anonymous
2010-04-16 11:52 ` anonymous
2010-04-16 13:51 ` Ludovic Courtès
2011-02-13 13:57 ` Ludovic Courtès
2011-10-22 14:24 ` bug#9838: " Ludovic Courtès
2011-10-22 15:59 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).