Skip Menu |

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

Report information
The Basics
Id: 88211
Status: resolved
Priority: 0/
Queue: Time-Piece

People
Owner: Nobody in particular
Requestors: david [...] weintraub.name
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 11:38:08 -0400
To: bug-Time-Piece [...] rt.cpan.org
From: David Weintraub <david [...] weintraub.name>
This doesn't work as expected: use strict; use warnings; use feature qw(say); use Time::Piece; use Time::Seconds; use Data::Dumper; my $year = "12"; my $days_in_year = "212"; my $julian_date = $year . $days_in_year; my $time = Time::Piece->strptime( $julian_date, "%y%j" ); say $time->ymd("/"); This returns 2012/01/01 instead of 2012/07/30. The %j part of the date is ignored. -- David Weintraub qazwart@gmail.com perl -e 'print "Just another second rate Perl Hacker\n";'
Subject: Re: [rt.cpan.org #88211] AutoReply: TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 11:45:00 -0400
To: bug-Time-Piece [...] rt.cpan.org
From: David Weintraub <david [...] weintraub.name>
Version information of what was tested: This was tested in Perl 5.12.4 and Perl 5.18.0 $Time::Piece:VERSION was 1.15_01 in Perl 5.12.4 and 1.20_01 in Perl 5.18.0, and version 1.22 in Perl 5.12.4. -- David Weintraub qazwart@gmail.com perl -e 'print "Just another second rate Perl Hacker\n";'
On Wed Aug 28 11:45:17 2013, david@weintraub.name wrote: Show quoted text
> Version information of what was tested: > > This was tested in Perl 5.12.4 and Perl 5.18.0
I find it worked in 1.13, and broke somewhere along the way to 1.20.
On Wed Aug 28 12:27:15 2013, DOUGW wrote: Show quoted text
> On Wed Aug 28 11:45:17 2013, david@weintraub.name wrote:
> > Version information of what was tested: > > > > This was tested in Perl 5.12.4 and Perl 5.18.0
> > I find it worked in 1.13, and broke somewhere along the way to 1.20.
More specifically, it worked in 1.16, and broke in 1.17.
Subject: Re: [rt.cpan.org #88211] TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 14:21:05 -0400
To: bug-Time-Piece [...] rt.cpan.org
From: David Weintraub <david [...] weintraub.name>
David Weintraub David@Weintraub.name ==================== Sure, call me crazy. They called Eddie Antar crazy too, but look at these low, low prices on all of these famous name brand appliances. On Aug 28, 2013, at 12:27 PM, Douglas Wilson via RT <bug-Time-Piece@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=88211 > > > On Wed Aug 28 11:45:17 2013, david@weintraub.name wrote:
>> Version information of what was tested: >> >> This was tested in Perl 5.12.4 and Perl 5.18.0
> > I find it worked in 1.13, and broke somewhere along the way to 1.20.
I tested version 1.15_01 in Perl 5.12.4, but it wasn't working in that particular revision on Mac OS X Mountain Lion. Is there a repository where the source is stored?
Subject: Re: [rt.cpan.org #88211] TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 15:02:56 -0400
To: David Weintraub via RT <bug-Time-Piece [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* David Weintraub via RT <bug-Time-Piece@rt.cpan.org> [2013-08-28T14:21:21] Show quoted text
> I tested version 1.15_01 in Perl 5.12.4, but it wasn't working in that > particular revision on Mac OS X Mountain Lion. Is there a repository where > the source is stored?
http://github.com/rjbs/Time-Piece should have all released versions, I think. -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #88211] TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 15:51:13 -0400
To: bug-Time-Piece [...] rt.cpan.org
From: David Weintraub <david [...] weintraub.name>
Just tried revisions from 1.13 to 1.16. None of them work on my Mac: I'm going to install Perl 5.10.1 on our Redhat server, and give it a try. David Weintraub David@Weintraub.name ==================== Sure, call me crazy. They called Eddie Antar crazy too, but look at these low, low prices on all of these famous name brand appliances. On Aug 28, 2013, at 3:03 PM, Ricardo Signes via RT <bug-Time-Piece@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=88211 > > > * David Weintraub via RT <bug-Time-Piece@rt.cpan.org> [2013-08-28T14:21:21]
>> I tested version 1.15_01 in Perl 5.12.4, but it wasn't working in that >> particular revision on Mac OS X Mountain Lion. Is there a repository where >> the source is stored?
> > http://github.com/rjbs/Time-Piece should have all released versions, I think. > > -- > rjbs > > <signature.asc>
Subject: Re: [rt.cpan.org #88211] TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 16:07:29 -0400
To: bug-Time-Piece [...] rt.cpan.org
From: David Weintraub <david [...] weintraub.name>
Installed Perl 5.10.1 with Time::Piece 1.15. Does not work. -- David Weintraub David@Weintraub.name On Aug 28, 2013, at 3:03 PM, Ricardo Signes via RT <bug-Time-Piece@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=88211 > > > * David Weintraub via RT <bug-Time-Piece@rt.cpan.org> [2013-08-28T14:21:21]
>> I tested version 1.15_01 in Perl 5.12.4, but it wasn't working in that >> particular revision on Mac OS X Mountain Lion. Is there a repository where >> the source is stored?
> > http://github.com/rjbs/Time-Piece should have all released versions, I think. > > -- > rjbs > > <signature.asc>
I am seeing a lot of activity on this ticket today. I wonder if this information would help: Prior to v1.17, many platforms had strptime delegate to the OS strptime. This meant that the strptime format strings varied from platform to platform. strptime was only portable in a relatively small subset. It also means that testing on different platforms prior to 1.17 will get different results, and you can't just test one platform to check whether percent-whatever wroks. From 1.17 on, everything uses the strptime bundled with Time-Piece. FWIW, that does appear to support %j, glancing at the code. Anyway, looking at versions prior to 1.17 is so different than I'm not sure it's really worth doing. I could be wrong. -- rjbs
On Wed Aug 28 16:20:29 2013, RJBS wrote: Show quoted text
> I am seeing a lot of activity on this ticket today. I wonder if this
That makes sense. There is a bug though. _strptime() parses the '%j' value ok, but then my_mini_mktime() wipes it out, because mday is 1, not 0, and my_mini_mktime only processes yday if (among other things) mday is zero. So, maybe the correct solution is to set mday to zero when parsing %j and setting yday: tm->tm_yday = i - 1; tm->tm_mday = 0; I've tested this, and it seems to work. I also added a test to t/02core.t: is(Time::Piece->strptime('12212', "%y%j")->ymd(), '2012-07-30', "Julian date parsing");
Subject: Re: [rt.cpan.org #88211] TIme::Piece can't create an object with Julian Date
Date: Wed, 28 Aug 2013 17:48:49 -0400
To: Douglas Wilson via RT <bug-Time-Piece [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
* Douglas Wilson via RT <bug-Time-Piece@rt.cpan.org> [2013-08-28T17:26:33] Show quoted text
> There is a bug though. _strptime() parses the '%j' value ok, but then > my_mini_mktime() wipes it out, because mday is 1, not 0, and my_mini_mktime > only processes yday if (among other things) mday is zero. So, maybe the > correct solution is to set mday to zero when parsing %j and setting yday:
Sounds good. I will review this a bit more and try to get it applied when I get down to Time::Piece in my regular patch-application rotation. Or maybe sooner so we can get this out in perl 5.19.4 Thanks very much! -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

applied in git! -- rjbs