Web lists-archives.com

Re: Perl does not support utime with nanosecond resolution




On 2019-05-17 15:44 +0200, Steve Keller wrote:

> The Perl module Time::HiRes in Debian stretch does support nanosecond
> resolution for stat() but not for utime(), although Linux has the
> utimensat() system call providing that function.
>
>     $ cat /etc/debian_version
>     9.9
>     $ perl -e "use Time::HiRes qw(stat);"
>     $ perl -e "use Time::HiRes qw(utime);"
>     "utime" is not exported by the Time::HiRes module
>     Can't continue after import errors at /usr/lib/x86_64-linux-gnu/perl/5.24/Time/HiRes.pm line 68.
>     BEGIN failed--compilation aborted at -e line 1.
>     $
>
> BTW, Ubuntu 18.04, with perl 5.26, supports this:
>
>     $ cat /etc/debian_version
>     buster/sid
>     $ perl -e "use Time::HiRes qw(stat);"
>     $ perl -e "use Time::HiRes qw(utime);"
>     $
>
> What's the reason for this

Stretch has only perl 5.24, and apparently utime support in Time::HiRes
was added after that.

> and can I enable utime() with nanosecond
> support in Debian stretch?

You would probably have to install a newer version of Time::HiRes from
CPAN[1].

Cheers,
       Sven


1. https://metacpan.org/pod/Time::HiRes