fix: use st_mtimespec instead of st_mtim on macos

This commit is contained in:
Gaeel Bradshaw 2021-08-15 13:10:34 +02:00
parent 5263538a29
commit 3f75fd5a3a

View file

@ -206,8 +206,10 @@ static int64_t getModTime(const std::string &file) {
return INT64_MIN; return INT64_MIN;
} }
#ifdef _WIN32 #if defined(_WIN32)
return (int64_t)s.st_mtime * 1000000; return (int64_t)s.st_mtime * 1000000;
#elif defined(__APPLE__) || defined(__NetBSD__)
return (int64_t)s.st_mtimespec.tv_sec * 1000000 + s.st_mtimespec.tv_nsec / 1000;
#else #else
return (int64_t)s.st_mtim.tv_sec * 1000000 + s.st_mtim.tv_nsec / 1000; return (int64_t)s.st_mtim.tv_sec * 1000000 + s.st_mtim.tv_nsec / 1000;
#endif #endif