diff options
Diffstat (limited to 'remake.c')
-rw-r--r-- | remake.c | 59 |
1 files changed, 38 insertions, 21 deletions
@@ -396,6 +396,15 @@ update_file_1 (file, depth) noexist = this_mtime == NONEXISTENT_MTIME; if (noexist) DBF (DB_BASIC, _("File `%s' does not exist.\n")); + else + { +#ifndef NO_ARCHIVES + /* Avoid spurious rebuilds of archive members due to their + timestamp resolution being only one second. */ + if (1 < FILE_TIMESTAMPS_PER_S && ar_name (file->name)) + this_mtime += FILE_TIMESTAMPS_PER_S - 1; +#endif + } must_make = noexist; @@ -1041,7 +1050,6 @@ f_mtime (file, search) char *arname, *memname; struct file *arfile; - time_t memtime; int arname_used = 0; time_t member_date; @@ -1154,7 +1162,7 @@ f_mtime (file, search) && mtime != NONEXISTENT_MTIME && !file->updated) { - static FILE_TIMESTAMP now; + static FILE_TIMESTAMP adjusted_now; FILE_TIMESTAMP adjusted_mtime = mtime; @@ -1178,19 +1186,28 @@ f_mtime (file, search) adjusted_mtime -= adjustment; #endif - /* If the file's time appears to be in the future, udpate our + /* If the file's time appears to be in the future, update our concept of the present and try once more. */ - if (now < adjusted_mtime - && (now = file_timestamp_now ()) < adjusted_mtime) - { - char mtimebuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; - char nowbuf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; - - file_timestamp_sprintf (mtimebuf, mtime); - file_timestamp_sprintf (nowbuf, now); - error (NILF, _("*** Warning: File `%s' has modification time in the future (%s > %s)"), - file->name, mtimebuf, nowbuf); - clock_skew_detected = 1; + if (adjusted_now < adjusted_mtime) + { + int resolution; + FILE_TIMESTAMP now = file_timestamp_now (&resolution); + adjusted_now = now + (resolution - 1); + if (adjusted_now < adjusted_mtime) + { +#ifdef NO_FLOAT + error (NILF, _("*** Warning: File `%s' has modification time in the future"), + file->name); +#else + double from_now = + (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now) + + ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now)) + / 1e9)); + error (NILF, _("*** Warning: File `%s' has modification time %.2g s in the future"), + file->name, from_now); +#endif + clock_skew_detected = 1; + } } } } @@ -1228,13 +1245,13 @@ name_mtime (name) { struct stat st; - while (stat (name, &st) != 0) - if (errno != EINTR) - { - if (errno != ENOENT && errno != ENOTDIR) - perror_with_name ("stat:", name); - return NONEXISTENT_MTIME; - } + while (stat (name, &st) != 0) + if (!EINTR_SET) + { + if (errno != ENOENT && errno != ENOTDIR) + perror_with_name ("stat:", name); + return NONEXISTENT_MTIME; + } return FILE_TIMESTAMP_STAT_MODTIME (name, st); } |