From 6576952ca5ac6cc42128d6ffa7d436bc5c4a92a0 Mon Sep 17 00:00:00 2001 From: David Malone Date: Sat, 27 Jul 2002 22:53:44 +0000 Subject: [PATCH] Make test check the tv_nsec part of a struct stat when comparing the mtimes of a file. (This is probably only useful if you have vfs.timestamp_precision set to something nonzero). PR: 39163 Submitted by: Hal Burch MFC after: 2 weeks --- bin/test/test.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bin/test/test.c b/bin/test/test.c index b3e51a4069c..7eb2df2ae09 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -521,19 +521,21 @@ newerf (const char *f1, const char *f2) { struct stat b1, b2; - return (stat (f1, &b1) == 0 && - stat (f2, &b2) == 0 && - b1.st_mtime > b2.st_mtime); + if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0) + return 0; + + if (b1.st_mtimespec.tv_sec > b2.st_mtimespec.tv_sec) + return 1; + if (b1.st_mtimespec.tv_sec < b2.st_mtimespec.tv_sec) + return 0; + + return (b1.st_mtimespec.tv_nsec > b2.st_mtimespec.tv_nsec); } static int olderf (const char *f1, const char *f2) { - struct stat b1, b2; - - return (stat (f1, &b1) == 0 && - stat (f2, &b2) == 0 && - b1.st_mtime < b2.st_mtime); + return (newerf(f2, f1)); } static int