On Thu, May 22, 2008 at 1:50 PM, Steve Peters <[EMAIL PROTECTED]> wrote:
> On Thu, May 22, 2008 at 7:37 AM, Craig A. Berry <[EMAIL PROTECTED]> wrote:
>> At 8:30 AM +0200 5/22/08, H.Merijn Brand wrote:
>>>On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <[EMAIL PROTECTED]>
>>>wrote:
>>>
>>>> A todo for VMS:
>>>>
>>>> In [EMAIL PROTECTED], 07arith.t is dying on test 11.
>>>>
>>>>  From the comments, it seems that it is expecting the _strptime function
>>>> (or something) to convert '2001-2-29' to '2001-3-1'.
>>>
>>>It's like this since a long time on all HP-UX too, and Steve P traced
>>>it to be some XS problem last night.
>>>
>>>Matt did not (yet) reply to my mails.
>>>
>>>> Instead it is failing with the message "Error parsing time at
>>> > ../lib/Time/Piece.pm line 615, <DATA> line 17.
>>
>> I noticed this too.  On VMS it boils down to passing to strptime a
>> time string for 29  February 2001, but unless I've lost some time
>> myself, 2001 was not a leap year, so it's not a valid time.  The
>> standard for strptime is silent about what level of validation, if
>> any, should be done on the incoming time string.
>>
>> Here's VMS:
>>
>> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', 
>> Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> Error parsing time at -e line 1.
>>
>> Here's Mac OS X:
>>
>> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', 
>> Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> 56|34|12|1|2|101|4|59|0|0|0
>>
>> If I'm reading this right, Mac OS X (and probably other BSDs) is
>> interpreting this as the first of March, which doesn't make much
>> sense to me, but may have a rationale behind it.  In any case,
>> Time::Piece seems to depend on this non-portable behavior, and even,
>> as John noted, to be specifically testing for it.
>>
>
> Actually, there isn't any non-portable stuff happening regarding
> dates.  The _strptime routine is supposed to see 2001-2-29 and realize
> that you really mean 2001-3-1.  For some reason, the code works pretty
> much everywhere else, but HP-UX and VMS.  Where the exact failure is,
> I haven't found exactly, but once I get off my lazy backside, I'll
> have an answer.
>

I hate it when the answer is right in front of my eyes.

There is code for an C based strptime() implementation, but it is only
used for Windows and QNX.  VMS and HP-UX are using their system
strptime(), as are Mac OS X, Linux, Solaris, etc.  The VMS and HP-UX
ones seem to be a little more strict regarding valid dates. The
solution here is to make HP-UX and VMS use Time::Piece's C-based
strptime().  I have it working in a hackish sort of way right now, but
won't have time to clean it up until later this evening.

Steve Peters
[EMAIL PROTECTED]

Reply via email to