From its description:
This module was created to enable test suites to test code at specific points in time. Specifically it overrides localtime, gmtime and time at compile time and then relies on the user supplying a mock time via set_relative_time, set_absolute_time or set_fixed_time to alter future calls to gmtime,time or localtime.You also asked:
I am very interested in your first statement, though, about replacing the globals. Can you please elaborate on that? Do you mean to replace the contents of existing perl library functions like time, localtime, etc.?Yes, except time, localtime, etc aren't library functions, but core functions. The source to Time::MockTime gives an example of how to do it:
BEGIN { *CORE::GLOBAL::time = \&Test::MockTime::time; *CORE::GLOBAL::localtime = \&Test::MockTime::localtime; *CORE::GLOBAL::gmtime = \&Test::MockTime::gmtime; }
In reply to Re^3: Artificial System Clock
by JavaFan
in thread Artificial System Clock
by JohnBoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |