diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-07-15 08:59:35 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-07-15 08:59:35 +0000 |
commit | dade1ade05ce0c447ceeb66a11977892aeff9ba8 (patch) | |
tree | e1f3510503722c3e6b304816c46e11dbc0102a02 /io | |
parent | 73299943388c0eebf6a9c8d6288e9da8289f9dca (diff) | |
download | glibc-dade1ade05ce0c447ceeb66a11977892aeff9ba8.tar glibc-dade1ade05ce0c447ceeb66a11977892aeff9ba8.tar.gz glibc-dade1ade05ce0c447ceeb66a11977892aeff9ba8.tar.bz2 glibc-dade1ade05ce0c447ceeb66a11977892aeff9ba8.zip |
Update.
2003-07-15 Ulrich Drepper <drepper@redhat.com>
* io/test-utime.c (main): Make test yet more robust.
Diffstat (limited to 'io')
-rw-r--r-- | io/test-utime.c | 15 |
1 files changed, 9 insertions, 6 deletions
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; |