1Test::MockTime::HiRes(3Upsme)r Contributed Perl DocumentaTteisotn::MockTime::HiRes(3pm)
2
3
4
6 Test::MockTime::HiRes - Replaces actual time with simulated high
7 resolution time
8
10 use Test::MockTime::HiRes qw(mock_time);
11
12 my $now = time;
13 mock_time {
14 time; # == $now;
15
16 sleep 3; # returns immediately
17
18 time; # == $now + 3;
19
20 usleep $microsecond;
21 } $now;
22
24 "Test::MockTime::HiRes" is a Time::HiRes compatible version of
25 Test::MockTime. You can wait milliseconds in simulated time.
26
27 It also provides "mock_time" to restrict the effect of the simulation
28 in a code block.
29
31 Test::MockTime
32
33 Time::HiRes
34
36 Copyright (C) INA Lintaro
37
38 This library is free software; you can redistribute it and/or modify it
39 under the same terms as Perl itself.
40
42 INA Lintaro <tarao.gnn@gmail.com>
43
44
45
46perl v5.38.0 2023-07-21 Test::MockTime::HiRes(3pm)