summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm')
-rw-r--r--gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm42
1 files changed, 35 insertions, 7 deletions
diff --git a/gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm b/gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm
index ad9a65c99d2..2071e5e83dc 100644
--- a/gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm
+++ b/gnu/usr.bin/perl/dist/Time-HiRes/HiRes.pm
@@ -23,12 +23,12 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF
TIMER_ABSTIME
d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
- d_nanosleep d_clock_gettime d_clock_getres
+ d_nanosleep d_clock_gettime d_clock_getres d_hires_utime
d_clock d_clock_nanosleep
- stat lstat
+ stat lstat utime
);
-our $VERSION = '1.9733';
+our $VERSION = '1.9739';
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -60,6 +60,7 @@ sub import {
($i eq 'clock' && !&d_clock) ||
($i eq 'nanosleep' && !&d_nanosleep) ||
($i eq 'usleep' && !&d_usleep) ||
+ ($i eq 'utime' && !&d_hires_utime) ||
($i eq 'ualarm' && !&d_ualarm)) {
require Carp;
Carp::croak("Time::HiRes::$i(): unimplemented in this platform");
@@ -92,7 +93,7 @@ Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep
clock_gettime clock_getres clock_nanosleep clock
- stat lstat );
+ stat lstat utime);
usleep ($microseconds);
nanosleep ($nanoseconds);
@@ -137,6 +138,9 @@ Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers
my @stat = stat(FH);
my @stat = lstat("file");
+ use Time::HiRes qw( utime );
+ utime $floating_seconds, $floating_seconds, file...;
+
=head1 DESCRIPTION
The C<Time::HiRes> module implements a Perl interface to the
@@ -446,6 +450,26 @@ if the operations are
the access time stamp from t2 need not be greater-than the modify
time stamp from t1: it may be equal or I<less>.
+=item utime LIST
+
+As L<perlfunc/utime>
+but with the ability to set the access/modify file timestamps
+in subsecond resolution, if the operating system and the filesystem
+both support such timestamps. To override the standard utime():
+
+ use Time::HiRes qw(utime);
+
+Test for the value of &Time::HiRes::d_hires_utime to find out whether
+the operating system supports setting subsecond file timestamps.
+
+As with CORE::utime(), passing undef as both the atime and mtime will
+call the syscall with a NULL argument.
+
+The actual achievable subsecond resolution depends on the combination
+of the operating system and the filesystem.
+
+Returns the number of files successfully changed.
+
=back
=head1 EXAMPLES
@@ -586,9 +610,13 @@ might help in this (in case your system supports CLOCK_MONOTONIC).
Some systems have APIs but not implementations: for example QNX and Haiku
have the interval timer APIs but not the functionality.
-In OS X clock_getres(), clock_gettime() and clock_nanosleep() are
-emulated using the Mach timers; as a side effect of being emulated
-the CLOCK_REALTIME and CLOCK_MONOTONIC are the same timer.
+In pre-Sierra macOS (pre-10.12, OS X) clock_getres(), clock_gettime()
+and clock_nanosleep() are emulated using the Mach timers; as a side
+effect of being emulated the CLOCK_REALTIME and CLOCK_MONOTONIC are
+the same timer.
+
+gnukfreebsd seems to have non-functional futimens() and utimensat()
+(at least as of 10.1): therefore the hires utime() does not work.
=head1 SEE ALSO