mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix uptime on MacOS
On MacOS the birth time is apparently not available so we use modification time instead.
This commit is contained in:
parent
da9f7a6540
commit
53bb2a6ad1
1 changed files with 1 additions and 2 deletions
3
src/fs.c
3
src/fs.c
|
|
@ -199,7 +199,6 @@ double fs_get_creation_time(const char *path)
|
||||||
|
|
||||||
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;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(path, &st) != 0)
|
if (stat(path, &st) != 0)
|
||||||
|
|
@ -207,7 +206,7 @@ double fs_get_creation_time(const char *path)
|
||||||
return -1;
|
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
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue