mirror of
https://github.com/facebook/zstd.git
synced 2025-08-10 04:43:07 +03:00
Use statbuf->st_mtim Again
This commit is contained in:
@@ -145,20 +145,20 @@ int UTIL_setFileStat(const char *filename, stat_t *statbuf)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* set access and modification times */
|
/* set access and modification times */
|
||||||
#if defined(_WIN32) || (PLATFORM_POSIX_VERSION < 200809L)
|
#if (PLATFORM_POSIX_VERSION >= 200809L) && defined(st_mtime)
|
||||||
|
{
|
||||||
|
/* (atime, mtime) */
|
||||||
|
struct timespec timebuf[2] = { {0, UTIME_NOW} };
|
||||||
|
timebuf[1] = statbuf->st_mtim;
|
||||||
|
res += utimensat(AT_FDCWD, filename, timebuf, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
struct utimbuf timebuf;
|
struct utimbuf timebuf;
|
||||||
timebuf.actime = time(NULL);
|
timebuf.actime = time(NULL);
|
||||||
timebuf.modtime = statbuf->st_mtime;
|
timebuf.modtime = statbuf->st_mtime;
|
||||||
res += utime(filename, &timebuf);
|
res += utime(filename, &timebuf);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
{
|
|
||||||
/* (atime, mtime) */
|
|
||||||
struct timespec timebuf[2] = { {0, UTIME_NOW} };
|
|
||||||
timebuf[1].tv_sec = statbuf->st_mtime;
|
|
||||||
res += utimensat(AT_FDCWD, filename, timebuf, 0);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
Reference in New Issue
Block a user