[bug#61240] [PATCH 2/2] Gracefully degrade if Time::HiRes is not available
Jacob Bachmeyer <[email protected]> Tue, 07 Feb 2023 23:29:30 -0600
| Newsgroups | gmane.comp.sysutils.automake.patches |
|---|---|
| Message-ID | <[email protected]> |
Paul Eggert wrote:
> On 2023-02-05 21:43, Jacob Bachmeyer wrote:
>> Should the patch be relative to commit
>> 6d6fc91c472fd84bd71a1b012fa9ab77bd94efea (before the version
>> requirement bump) or should it include reverting commit
>> 4e3744a15c4d8bdb46c11ead2fb56c5f591b714b (the version requirement bump)?
>
> Might as well do it all at once, thanks.
This second patch is the change I previously suggested. As noted in the
patch, please use my gnu.org address for public attribution. (I would
prefer to minimize any indirect advertising of GMail.)
I have found no better ChangeLog entry than the commit message:
* lib/Automake/FileUtils.pm: Gracefully degrade if Time::HiRes is
not available.
8<------
From: Jacob Bachmeyer <[email protected]>
Date: Tue, 7 Feb 2023 22:42:59 -0600
Subject: [PATCH 2/2] Gracefully degrade if Time::HiRes is not available
---
lib/Automake/FileUtils.pm | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/Automake/FileUtils.pm b/lib/Automake/FileUtils.pm
index 697ff7e..8d0b368 100644
--- a/lib/Automake/FileUtils.pm
+++ b/lib/Automake/FileUtils.pm
@@ -39,9 +39,12 @@ use strict;
use warnings FATAL => 'all';
use Exporter;
-use Time::HiRes qw(stat);
use IO::File;
+# use sub-second resolution timestamps if available,
+# carry on with one-second resolution timestamps if that is all we have
+BEGIN { eval { require Time::HiRes; import Time::HiRes qw(stat) } }
+
use Automake::Channels;
use Automake::ChannelDefs;
--
8<------
-- Jacob