mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
Set M-Time Nanoseconds
This commit is contained in:
@ -57,7 +57,8 @@ int UTIL_setFileStat(const char *filename, stat_t *statbuf)
|
|||||||
#if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L)
|
#if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L)
|
||||||
struct utimbuf timebuf;
|
struct utimbuf timebuf;
|
||||||
#else
|
#else
|
||||||
struct timespec timebuf[2] = {};
|
/* (atime, mtime) */
|
||||||
|
struct timespec timebuf[2] = { {0, UTIME_NOW}, statbuf->st_mtim };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!UTIL_isRegularFile(filename))
|
if (!UTIL_isRegularFile(filename))
|
||||||
@ -68,8 +69,6 @@ int UTIL_setFileStat(const char *filename, stat_t *statbuf)
|
|||||||
timebuf.modtime = statbuf->st_mtime;
|
timebuf.modtime = statbuf->st_mtime;
|
||||||
res += utime(filename, &timebuf); /* set access and modification times */
|
res += utime(filename, &timebuf); /* set access and modification times */
|
||||||
#else
|
#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 */
|
res += utimensat(AT_FDCWD, filename, timebuf, 0); /* set access and modification times */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user