From dade1ade05ce0c447ceeb66a11977892aeff9ba8 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 15 Jul 2003 08:59:35 +0000 Subject: Update. 2003-07-15 Ulrich Drepper * io/test-utime.c (main): Make test yet more robust. --- io/test-utime.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'io') diff --git a/io/test-utime.c b/io/test-utime.c index 24c287160b..2f8aa57266 100644 --- a/io/test-utime.c +++ b/io/test-utime.c @@ -76,6 +76,12 @@ main (int argc, char *argv[]) return 1; } + /* The clocks used to set the modification time and that used in the + time() call need not be the same. They need not have the same + precision. Therefore we delay the following operation by one + second which makes sure we can compare with second precision. */ + sleep (1); + if (utime (file, NULL)) { perror ("utime NULL"); @@ -83,6 +89,8 @@ main (int argc, char *argv[]) return 1; } + sleep (1); + now2 = time (NULL); if (now2 == (time_t)-1) { @@ -112,12 +120,7 @@ main (int argc, char *argv[]) return 1; } -#ifdef _STATBUF_ST_NSEC -# define CORR (stnow.st_mtim.tv_nsec == 0 ? 0 : 1) -#else -# define CORR 0 -#endif - if (stnow.st_mtime + CORR < now1 || stnow.st_mtime > now2) + if (stnow.st_mtime < now1 || stnow.st_mtime > now2) { printf ("modtime %ld <%ld >%ld\n", stnow.st_mtime, now1, now2); return 1; -- cgit v1.2.3