]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Restore lib/Autom4te/FileUtils.pm local fixes
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 21 Jan 2023 07:15:19 +0000 (01:15 -0600)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 21 Jan 2023 07:18:08 +0000 (01:18 -0600)
These were lost by 'make fetch'.

lib/Autom4te/FileUtils.pm

index 5d0deff9d1c72c3e8d726560cc9edb75a6a71f29..8f7e351a632cfb5708af903ab5343a8026dd2b4f 100644 (file)
@@ -39,7 +39,7 @@ use strict;
 use warnings FATAL => 'all';
 
 use Exporter;
-use File::stat;
+use Time::HiRes qw(stat);
 use IO::File;
 
 use Autom4te::Channels;
@@ -115,10 +115,16 @@ sub mtime ($)
   return 0
     if $file eq '-' || ! -f $file;
 
-  my $stat = stat ($file)
+  my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+    $atime,$mtime,$ctime,$blksize,$blocks) = stat ($file)
     or fatal "cannot stat $file: $!";
 
-  return $stat->mtime;
+  # Unfortunately Time::HiRes converts timestamps to floating-point, and the
+  # rounding error can be several nanoseconds for circa-2021 timestamps.
+  # Perhaps some day Perl will support accurate file timestamps.  For now, do
+  # the best we can without going outside Perl.
+
+  return $mtime;
 }