NAME Time::Monotonic - A clock source that only increments and never jumps
SYNOPSIS
use Time::Monotonic qw(monotonic_time);
$t1 = monotonic_time();
sleep(1);
$t2 = monotonic_time();
die unless Time::Monotonic::is_monotonic();
say "Backend API: ".Time::Monotonic::backend();
DESCRIPTION
Time::Monotonic gives access to monotonic clocks on various platforms (Mac OS X, Windows, and POSIX). A monotonic clock is a time source that won't ever jump forward or backward (due to NTP or Daylight Savings Time updates).
Time::Monotonic uses Thomas Habets's cross platform "monotonic_clock" library under the hood.
API
monotonic_time()
-
This function returns a monotonic time as a floating point number (fractional seconds). Note that this time will not be comparable to times from the built-in
time
function. The only real use of the value is comparing against other values returned frommonotonic_time()
. backend()
-
This function returns which backend clock functions are in use. It will be one of:
is_monotonic()
-
This will return true if the backend supports monotonic clocks. This can return false if there is no support for monotonic clocks in the current Platform/OS/hardware combo.
SEE ALSO
Why are monotonic clocks important?
AUTHOR
David Caldwell <david@porkrind.org>
COPYRIGHT AND LICENSE
Copyright (C) 2015 by David Caldwell
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.