Hi All,

In the process of installing Matt Seargent's Time::Piece module on my OS X
box (a forthcoming version should support OS X -- the one currently on the
CPAN does not), one of the tests failed. That test used the strftime system
function to format the date. It returned 'V' for the '%V' format, which,
according to the OS X strftime man page, is

     %V    is replaced by the week number of the year (Monday as the first
           day of the week) as a decimal number (01-53).  If the week
           containing January 1 has four or more days in the new year, then
           it is week 1; otherwise it is week 53 of the previous year, and
           the next week is week 1.

Since Time::Piece uses the OS's own strftime function for its work, it
seemed strange to me that one of the formatting characters documented on the
system just simply wouldn't work.

So I put together a quick test (using POSIX::strftime) of all the documented
OS X strftime formatting characters to see what would happen. It turns out
that 4 of the 37 formatting characters fail to do what they document. The
four are:

  '%C' -- Should be '20', for the century, but is 'Fri Dec 14 17:57:37 2001'
          instead. Was it changed to ctime format but not documented?

  '%u' -- Should be day of week, 5 in the example. Turns up 'u' instead,
          which is just strange.

  '%V' -- Should be week of month, 50 in the example. Turns up 'V' instead,
          which is just strange.

  '%Z' -- Should be the time zone, 'PST', but turns up nothing ('') instead.

I enclose the script for your perusal.

So my question is, does anyone know why the OS X strftime function works
differently than it has been documented? Could it be that it has a bug or
two, or that Perl somehow doesn't bind properly (the latter makes no sense
to me).

FWIW, I tested this script on my i686 RedHat box, and all the tests passed
(excepting some difference necessitated by a different locale).

Thanks,

David

-- 
David Wheeler                                     AIM: dwTheory
[EMAIL PROTECTED]                                 ICQ: 15726394
http://david.wheeler.net/                      Yahoo!: dew7e
                                               Jabber: [EMAIL PROTECTED]


Attachment: strftimetest
Description: Binary data

Reply via email to