On 9/18/12 3:35 AM, Brian Raven wrote: >> -----Original Message----- >> From: activeperl-boun...@listserv.activestate.com [mailto:activeperl- >> boun...@listserv.activestate.com] On Behalf Of Philip Prindeville >> Sent: 18 September 2012 04:20 >> To: $Bill Luebkert >> Cc: activeperl@listserv.ActiveState.com >> Subject: Re: Issues w/ POSIX's strftime() ? >> >> On 9/14/12 9:31 PM, $Bill Luebkert wrote: >>> On 9/14/2012 18:12, Philip Prindeville wrote: >>>> I tried to use strftime() with '%T' and it fails... but works when I >> use '%H:%M:%S' instead. Is this a known issue? >>> I thought I reported that years ago - you have to use %H:%M:%S >> instead >>> until someone fixes it. >> >> POSIX seems to be part of Perl core... I looked on CPAN for an RT queue >> for bugs but there wasn't one. >> >> How does one go about reporting a bug? >> >> >>>> Also, '%Z' is supposed to give the time zone name or abbreviation, >> but '%z' is supposed to give the time zone offset as +/-hhmm. >>>> >>>> However, I just tried, and '%z' and '%Z' yield identical results. >>> Same here (see below). >>> >>>> I'm thinking that under Win32, %Z (and %z) should be formatted via: >>>> >>>> TIME_ZONE_INFORMATION tzinfo; >>>> DWORD ret = GetTimeZoneInformation(&tzinfo); >>>> >>>> if (ret == 2) { >>>> strcpy(tzName, tzinfo.DaylightName); } else { >>>> strcpy(tzName, tzinfo.StandardName); } >>>> >>>> sprintf(tzOffset, "%c%02d%02d", (tzinfo.Bias < 0 ? '-' : '+'), >>>> abs(tzinfo.Bias) / 60, abs(tzinfo.Bias) % 60); >>>> >>>> What am I missing? >>> It's supposed to follow ANSI C standard (C89). >>> I think %z is 'Single UNIX' only - rather than ANSI C89. >>> >> >> Well, the number of Internet applications that require an RFC-2822 >> formatted Date or timestamp is significant. Whether it's in the >> standard or not, the need to support it merits exceeding the narrow >> requirements of the spec. > > AIUI, POSIX::strftime calls the function provided by the underlying OS. This > is why the documentation makes the following recommendation. > > "If you want your code to be portable, your format (fmt) argument should use > only the conversion specifiers defined by the ANSI C standard (C89, to play > safe). These are aAbBcdHIjmMpSUwWxXyYZ%." > > As such, I probably wouldn't be considered a bug, at least not with the Perl > distribution. So, unless you can persuade Microsoft to improve their POSIX > support, you will have to restrict the format specifiers that you > use on win32/win64 platforms to those specified. > > HTH > > -- > Brian Raven
Well, I remember that when I was at Microsoft (lowers his head), there was a lot of use of ActiveState perl in the build machinery for the Windows kernel. I wouldn't be surprised if Microsoft had a couple of full-time ActiveState folks on contract, in fact. Maybe if one is on the list, they can suggest that strftime() be amended to have '%z' return the timezone offset in hours/minus and sign. -Philip _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs