diff options
author | Paul Smith <psmith@gnu.org> | 2000-06-07 05:43:37 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2000-06-07 05:43:37 +0000 |
commit | 4a5550c8225d762f684d4047e20cc45274b6a785 (patch) | |
tree | 943515aca19373ad0fe0dce0cb852c2eca7b0cab /file.c | |
parent | e5c40f6e5ad9d485f7caada51e2361758baa67dd (diff) | |
download | gunmake-4a5550c8225d762f684d4047e20cc45274b6a785.tar.gz |
* Lots of bug fixes and cleanup; new i18n files, etc.
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -569,11 +569,29 @@ set_command_state (file, state) FILE_TIMESTAMP file_timestamp_now () { + /* Don't bother with high-resolution clocks if file timestamps have + only one-second resolution. The code below should work, but it's + not worth the hassle of debugging it on hosts where it fails. */ + if (1 < FILE_TIMESTAMPS_PER_S) + { #if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME - struct timespec timespec; - if (clock_gettime (CLOCK_REALTIME, ×pec) == 0) - return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec, timespec.tv_nsec); + { + struct timespec timespec; + if (clock_gettime (CLOCK_REALTIME, ×pec) == 0) + return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec, + timespec.tv_nsec); + } +#endif +#if HAVE_GETTIMEOFDAY + { + struct timeval timeval; + if (gettimeofday (&timeval, 0) == 0) + return FILE_TIMESTAMP_FROM_S_AND_NS (timeval.tv_sec, + timeval.tv_usec * 1000); + } #endif + } + return FILE_TIMESTAMP_FROM_S_AND_NS (time ((time_t *) 0), 0); } |