[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#61240] improve high-res file timestamp in Automake

From: Jacob Bachmeyer
Subject: [bug#61240] improve high-res file timestamp in Automake
Date: Sun, 05 Feb 2023 19:14:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20090807 SeaMonkey/1.1.17 Mnenhy/

Paul Eggert wrote:
On 2023-02-04 16:02, Jacob Bachmeyer wrote:
In any case, you will still need to account for the possibility that Time::HiRes::stat() might not actually have higher resolution, depending on the filesystem.

That's fine. All we want is the exact file timestamp. If the file system timestamp resolution is only 2 s, then we want that multiple of 2. Admittedly we can't get the exact file timestamp on many modern file systems since Time::HiRes is precise only to the nearest ~238 ns for today's timestamps, but the idea is to get what we easily can.

How often is Perl built to use long doubles these days? (That was an option beginning with Perl 5.6.)

There are also the no-runtime-overhead options of using "eval { use Time::HiRes qw(stat) };" which will replace stat() with the hi-res version if it is available and continue with the regular stat() builtin if not, or "use constant HAVE_Time_HiRes => eval { use Time::HiRes };" and a conditional "if (HAVE_Time_HiRes) { ... } else { ... }" as I suggested as an improvement to Mike Frysinger's patch.

Sorry, I don't remember seeing that suggestion. I guess it was in another thread. Could you resend that patch to and cc me? Preferably a patch against the latest Automake, in "git format-patch" format; see <> for how to get bleeding-edge Automake. The idea would be to port bleeding-edge Automake to Perl < 5.10 when that's easy.

It was bug#60807. Looking at the patch, I suspect that I will need to take a closer look at the code: the existing code before Mike's patch used File::stat, which I suspect may not be compatible with Time::HiRes::stat (not compatible in the sense that File::stat's override of stat() probably will not use Time::HiRes's override of stat()). If so, then "use Time::HiRes qw(stat);" will not do what you want because either stat() will either cease to return an object or will not have subsecond resolution.

Looking at the code, commit 01bf65daf6f6627b56fbe78fc436fd877ccd3537 appears fine, all I am asking is that commit 4e3744a15c4d8bdb46c11ead2fb56c5f591b714b be reverted. The current Automake Git master should actually work on Perl 5.6 if Time::HiRes has been installed, which was possible with 5.6 although it was bundled with Perl beginning with the 5.7.3 development release.

In other words, bleeding-edge Automake is already ported to Perl < 5.10, in fact it should run on 5.8 out-of-the-box and 5.6 if Time::HiRes has been installed from CPAN (or perhaps BackPAN today, but Time::HiRes was on CPAN when 5.6 was current).

Please bear in mind that I stopped coding in Perl 30 years ago and so am a bit rusty.

Yes, very---30 years ago would have been before Perl 5.6! Much of modern Perl did not exist then...

-- Jacob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]