Fix uptime on MacOS

On MacOS the birth time is apparently not available so we use
modification time instead.
This commit is contained in:
Martin Lund 2024-07-09 22:12:39 +02:00
parent da9f7a6540
commit 53bb2a6ad1

View file

@ -199,7 +199,6 @@ double fs_get_creation_time(const char *path)
double fs_get_creation_time(const char *path)
{
// Use stat on macOS to access creation time
struct stat st;
if (stat(path, &st) != 0)
@ -207,7 +206,7 @@ double fs_get_creation_time(const char *path)
return -1;
}
return st.st_birthtimespec.tv_sec + st.st_birthtimespec.tv_nsec / 1e9;
return st.st_mtimespec.tv_sec + st.st_mtimespec.tv_nsec / 1e9;
}
#else