Skip Menu |

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

Report information
The Basics
Id: 32375
Status: resolved
Priority: 0/
Queue: Time-Fake

People
Owner: Nobody in particular
Requestors: +
cpan
org
Cc:
AdminCc:

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



Subject: DateTime always gets epoch of '1'
$ perl -MTime::Fake='+2d' -e 'require DateTime; print time, " ", DateTime- Show quoted text
>from_epoch(epoch => time)->epoch,"\n"'
1200745458 1 I'm not quite sure whats happening there... But it also does weird things even if Time::Fake is just loaded $ perl -MTime::Fake -e 'require DateTime; print DateTime->from_epoch(epoch => 1200745458)->epoch,"\n"' 1 $ perl -e 'require DateTime; print DateTime->from_epoch(epoch => 1200745458)- Show quoted text
>epoch,"\n"'
1200745458 Shame this doesn't work, cos otherwise its a very useful looking module.
Okay i found the problem: DB<8> x scalar CORE::gmtime 0 'Thu Jan 17 12:38:10 2008' DB<9> x scalar CORE::gmtime(1200746256) 0 'Sat Jan 19 12:37:36 2008' DB<10> x scalar CORE::gmtime(@_) 0 'Thu Jan 1 00:00:01 1970' DB<11> x scalar CORE::gmtime($_[0]) 0 'Sat Jan 19 12:37:36 2008' DB<12> p scalar @_ 1 DB<13> x @_ 0 1200746256 DB<14> push @_, 2; DB<15> x @_ 0 1200746256 1 2 DB<16> x scalar CORE::gmtime(@_) 0 'Thu Jan 1 00:00:02 1970' CORE::gmtime has a prototype of ($) Which forces @_ into scalar context. The CORE::GLOBAL::gmtime needs to be -rewritten as: *CORE::GLOBAL::gmtime = sub(;$) { @_ ? CORE::gmtime($_[0]) : CORE::gmtime(CORE::time() + $OFFSET); }; I imagine localtime will also suffer from similar problems.
Thanks a lot for spotting that problem and also tracking it down. A bugfix version 0.11 has been uploaded and will be visible soon.