Test::Time(3pm)

Test::Time3pm

Overrides the time() and sleep() core functions for testing

Usage

    use Test::Time;
    # Freeze time
    my $now = time();
    # Increment internal time (returns immediately)
    sleep 1;
    # Return internal time incremented by 1
    my $then = time();

Overview

Test::Time can be used to test modules that deal with time. Once you "use" this module, all references to "time", "localtime" and "sleep" will be internalized. You can set custom time by passing time => number after the "use" statement:

    use Test::Time time => 1;
    my $now = time;    # $now is equal to 1
    sleep 300;         # returns immediately, displaying a note
    my $then = time;   # $then equals to 301

Releases

5 releases since Debian 9 (Stretch); the text changed 3 times.

  1. 9
  2. 10
  3. 11
  4. 12–13

Author

cho45 <[email protected]>

License

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

From libtest-time-perl 0.092-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.