Skip Menu |
 

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 64789
Status: new
Estimated: 10 min
Worked: 10 min
Priority: 10/
Queue: TimeDate

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

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



Subject: Now way to set epoch
Download (untitled) / with headers
text/plain 423b
Right now it's impossible to define the epoch that's used. This isn't necessarily useful unless you have a machine with a time that is differnt from another machine on the same network, or you pull your time from another source, such as database, etc. Because of this I've made some very minor backwards compatible modifications to str2time() to accept a different initial argument. Attached is the patch to do this. -cf
Subject: add-time.txt
Download add-time.txt
text/plain 1k
--- lib/Date/Parse.pm 2011-01-12 00:57:56.000000000 -0700 +++ lib/Date/Parse.pm 2011-01-12 01:15:59.000000000 -0700 @@ -15,7 +15,7 @@ @ISA = qw(Exporter); @EXPORT = qw(&strtotime &str2time &strptime); -$VERSION = "2.30"; +$VERSION = "2.31"; my %month = ( january => 0, @@ -228,13 +228,21 @@ sub str2time { + my $T; + if(ref($_[0]) eq 'ARRAY'){ + $T = $_[0]; + ($_[0], $T) = @$T; + } else { + $T = time(); + } + my @t = strptime(@_); return undef unless @t; my($ss,$mm,$hh,$day,$month,$year,$zone) = @t; - my @lt = localtime(time); + my @lt = localtime($T); $hh ||= 0; $mm ||= 0; @@ -314,6 +322,10 @@ C<ZONE>, if given, specifies the timezone to assume when parsing if the date string does not specify a timezone. +B<OPTIONALLY> call C<str2time> with C<DATE> argument encapsulated in a two element +array reference, with the first element being the standard C<DATE> string and the +second being epoch time, (normally provided by C<time>) + =item strptime(DATE [, ZONE]) C<strptime> takes the same arguments as str2time but returns an array of


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.