Test::Time::HiRes - drop-in replacement for Test::Time to work with Time::HiRes
# ensure loaded before any code importing functions from Time::HiRes
use Test::Time::HiRes time => 123.456789;
# Freeze time
my $now = time();
my $now_hires = Time::HiRes::time();
# Increment internal time (returns immediately)
sleep 1; # seconds
usleep 1000; # microseconds
# Return internal time incremented by 1.001s
my $then = time();
my $then_hires = Time::HiRes::time();
# set/reset time
Test::Time::HiRes->set_time( 123.456789 );
Test::Time::HiRes->unimport(); # turn off behaviour
Drop-in replacement for Test::Time that also works with the Time::HiRes
functions usleep
and gettimeofday
.
Must be loaded before importing functions from Time::HiRes.
Patches/suggestions very welcome. This was just a quick fix to a problem.
Please report any bugs or feature requests through the issue tracker at https://github.com/mjemmeson/Test-Time-HiRes/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/mjemmeson/Test-Time-HiRes
git clone git://github.com/mjemmeson/Test-Time-HiRes.git
Michael Jemmeson mjemmeson@cpan.org
Gianni Ceccarelli dakkar@thenautilus.net Theo van Hoesel <Th.J.v.Hoesel+CPAN@gmail.com<gt>
Copyright 2018- Michael Jemmeson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.