Web::DateTime::Clock
Clocks
SYNOPSIS
use Web::DateTime::Clock;
$clock = Web::DateTime::Clock->realtime_clock;
warn $clock->();
$clock = Web::DateTime::Clock->monotonic_clock;
warn $clock->();
DESCRIPTION
The Web::DateTime::Clock
module defines clocks.
CLOCKS
A clock is a Perl subroutine that returns a number representing the number of seconds from some epoch. It can have fractional part.
In addition to the clocks provided by this module, applications can define their own clocks, as long as they conform to the definition above. For example, a test script can use a constant subroutine as a clock.
METHODS
There are following methods:
$clock = Web::DateTime::Clock->realtime_clock
-
Return a walltime clock, i.e. a clock that returns the "real" time. The number represents the number of seconds from the Epoch, possibly with fractional part. This is the so-called "unix time".
$clock = Web::DateTime::Clock->monotonic_clock
-
Return a monotonic clock, i.e. a clock whose value is monotonically increasing. The number represents the number of seconds from a clock-dependent epoch, possibly with fractional part.
DEPENDENCY
This module requires Time::HiRes, which is a core module of Perl. Please note that, as clock_gettime
, which is a standard POSIX function, is not implemented on Mac OS X, Time::HiRes older than 1.9732 (2016-03) is broken on that platform.
SPECIFICATION
High Resolution Time Level 2 <https://w3c.github.io/hr-time/>
.
AUTHOR
Wakaba <wakaba@suikawiki.org>.
LICENSE
Copyright 2016 Wakaba <wakaba@suikawiki.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.