bugGuile - Bugs: bug #29575, SRFI-19 conversion issue

 
 

bug #29575: SRFI-19 conversion issue

Submitted by:  None
Submitted on:  Fri 16 Apr 2010 09:08:21 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Works For Me
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 16 Apr 2010 01:51:48 PM UTC, comment #3:

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'.

Ludovic Courtès <civodul>
Project Administrator
Fri 16 Apr 2010 11:52:18 AM UTC, comment #2:

Furthermore, there doesn't appear to be an issue for 2010 or 2006, so just 2007-2009.

Anonymous
Fri 16 Apr 2010 09:09:45 AM UTC, comment #1:

Sorry -- Error discovered using Debian Lenny, Guile version 1.8.5 via apt-get.

Anonymous
Fri 16 Apr 2010 09:08:21 AM UTC, original submission:

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.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by civodul (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Oct 2011 02:24:13 PM UTCcivodulOpen/ClosedOpen=>Closed
    Sun 13 Feb 2011 01:57:30 PM UTCcivodulStatusNone=>Works For Me

    Back to the top


    Powered by Savane 3.1-cleanup1