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

 
 

bug #29575: SRFI-19 conversion issue

Submitter:  None
Submitted:  Fri 16 Apr 2010 09:08:21 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-10-22 civodul Open/ClosedOpen Closed
    2011-02-13 civodul StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code