[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #1014: posix: string->time preserves the year accross
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #1014: posix: string->time preserves the year accross multiple invocations |
Date: |
Fri, 24 May 2013 19:08:16 -0000 |
#1014: posix: string->time preserves the year accross multiple invocations
----------------------------+-----------------------------------------------
Reporter: certainty | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.9.0
Component: core libraries | Version: 4.8.x
Keywords: |
----------------------------+-----------------------------------------------
This bug has been reported by bryanvick.
The following snippet reproduces the problem:
#;1> (string->time "5/18" "%m/%d")
#(0 0 0 18 4 0 5 137 #f 0)
#;2> (string->time "5/18" "%m/%y")
#(0 0 0 18 4 118 5 137 #f 0)
#;3> (string->time "5/18" "%m/%d")
#(0 0 0 18 4 118 5 137 #f 0)
Though the first and the third call should return the same
result, they don't. That's because the second call to string->time
sets the year which is preserved in subsequent calls.
First researches showed that the implementation of C_strptime passes a
pointer to the global struct C_tm in the call to strptime(3), which
doesn't reset the fields and so a few of them may remain
unchanged. Possible fixes could be:
1) use a fresh struct
2) reset C_tm before it is used
--
Ticket URL: <http://bugs.call-cc.org/ticket/1014>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #1014: posix: string->time preserves the year accross multiple invocations,
Chicken Trac <=