![]() |
|
There's more than one way to do things | |
PerlMonks |
Re: Simulating the Futureby blokhead (Monsignor) |
on Jan 04, 2008 at 19:46 UTC ( #660460=note: print w/replies, xml ) | Need Help?? |
Update 2: This module has been cleaned up a little bit and some small features added (not updated in the code in this node), and I've uploaded it to CPAN as Time::Fake. It will appear on CPAN after the normal processing time...
Here's a little module that I just threw together. It overrides the builtin time sub (Update: and also localtime and gmtime) to adjust the output by some offset: You can use this as follows: or or This is just a proof of concept but you can probably extend it to however your code figures out the current time. I.e, there may be other ways to obtain the time in perl that I haven't thought of. Perhaps I could make this a little nicer, package it up, and send it off to CPAN? That is, if something like this really isn't on CPAN already.. Update: some caveats that I can think of, off the top of my head:
blokhead
In Section
Seekers of Perl Wisdom
|
|