From: W. Felix Handte Date: Thu, 12 Sep 2019 15:48:46 +0000 (-0400) Subject: Set M-Time Nanoseconds X-Git-Tag: v1.4.4~1^2~48^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a9baae9cfa9b5684f553fc9a03a7becee16287e;p=thirdparty%2Fzstd.git Set M-Time Nanoseconds --- diff --git a/programs/util.c b/programs/util.c index b05ac3e9d..3e4c3335f 100644 --- a/programs/util.c +++ b/programs/util.c @@ -57,7 +57,8 @@ int UTIL_setFileStat(const char *filename, stat_t *statbuf) #if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L) struct utimbuf timebuf; #else - struct timespec timebuf[2] = {}; + /* (atime, mtime) */ + struct timespec timebuf[2] = { {0, UTIME_NOW}, statbuf->st_mtim }; #endif if (!UTIL_isRegularFile(filename)) @@ -68,8 +69,6 @@ int UTIL_setFileStat(const char *filename, stat_t *statbuf) timebuf.modtime = statbuf->st_mtime; res += utime(filename, &timebuf); /* set access and modification times */ #else - timebuf[0].tv_nsec = UTIME_NOW; - timebuf[1].tv_sec = statbuf->st_mtime; res += utimensat(AT_FDCWD, filename, timebuf, 0); /* set access and modification times */ #endif