Skip Menu |

This queue is for tickets about the Time-Piece CPAN distribution.

Report information
The Basics
Id: 105507
Status: open
Priority: 0/
Queue: Time-Piece

People
Owner: Nobody in particular
Requestors: MLAWREN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.27
  • 1.30
Fixed in: (no value)



Subject: [Win32] strftime fails to substitute week number for %V
On Win32 (Strawberry Perl) the following fails to work as expected: use Time::Piece warn localtime->strftime('%V'); I get a "Warning: something's wrong" instead of the week number that I see under Linux. I don't see anything in the documentation mentioning this behaviour. -- Mark Lawrence
On Fri Jun 26 11:51:10 2015, MLAWREN wrote: Show quoted text
> On Win32 (Strawberry Perl) the following fails to work as expected: > > use Time::Piece > warn localtime->strftime('%V'); > > I get a "Warning: something's wrong" instead of the week number that I > see under Linux. I don't see anything in the documentation mentioning > this behaviour.
I see in Time-Piece/t/02core.t: skip "can't strftime %V on Win32 or QNX or VOS" So looks like the test is skipped on those platforms. Not sure why '%V' is stated as not working. I will investigate and/or at least update the docs with what doesn't work on what platforms.
On Fri Jun 26 11:51:10 2015, MLAWREN wrote: Show quoted text
> On Win32 (Strawberry Perl) the following fails to work as expected: > > use Time::Piece > warn localtime->strftime('%V'); > > I get a "Warning: something's wrong" instead of the week number that I > see under Linux. I don't see anything in the documentation mentioning > this behaviour.
After doing some testing, %V indeed doesn't seem to work with Windows. I'll add it to the docs. You can however do localtime->week()
Subject: Re: [rt.cpan.org #105507] [Win32] strftime fails to substitute week number for %V
Date: Fri, 26 Jun 2015 21:38:03 +0200
To: Samuel Smith via RT <bug-Time-Piece [...] rt.cpan.org>
From: nomad [...] null.net
On Fri Jun 26, 2015 at 12:42:14PM -0400, Samuel Smith via RT wrote: Show quoted text
> > After doing some testing, %V indeed doesn't seem to work with > Windows. I'll add it to the docs. You can however do > localtime->week()
Thanks for the hint - I missed that and was half thinking about how to calculate the week myself. I now see however that ->week is relatively easily calculated in pure Perl so it seems a little odd that the strftime version doesn't work in Windows. Although I can't even find any reference to a 'V' character in the .xs file so I don't know how it works under other platforms either. Thanks, Mark. -- Mark Lawrence
On Fri Jun 26 15:38:19 2015, nomad@null.net wrote: Show quoted text
> On Fri Jun 26, 2015 at 12:42:14PM -0400, Samuel Smith via RT wrote:
> > > > After doing some testing, %V indeed doesn't seem to work with > > Windows. I'll add it to the docs. You can however do > > localtime->week()
> > Thanks for the hint - I missed that and was half thinking about how to > calculate the week myself. > > I now see however that ->week is relatively easily calculated in pure > Perl so it seems a little odd that the strftime version doesn't work in > Windows. Although I can't even find any reference to a 'V' character > in the .xs file so I don't know how it works under other platforms > either. > > Thanks, > Mark.
Time::Piece::strftime calls _strftime in Piece.xs. From there the function call is handled by the C runtime which can be different per platform. A rough overview is here: https://github.com/lattera/glibc/blob/master/time/strftime_l.c with the actual code being at https://github.com/lattera/glibc/blob/master/time/strftime_l.c#L1219 with a call to iso_week_days() No clue why such a simple thing isn't on Windows.
Subject: Re: [rt.cpan.org #105507] [Win32] strftime fails to substitute week number for %V
Date: Tue, 30 Jun 2015 12:11:44 +0200
To: Samuel Smith via RT <bug-Time-Piece [...] rt.cpan.org>
From: Mark Lawrence <nomad [...] null.net>
Thanks for the in-depth notes. I have discovered a couple more formats that don't work on MSWin32 - %F and %R. Perhaps the documentation could include an exhaustive search of the formats that do/don't work on that platform... -- Mark Lawrence