--- sysdeps/mach/clock_gettime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c index 6fffad39f5..22faf85730 100644 --- a/sysdeps/mach/clock_gettime.c +++ b/sysdeps/mach/clock_gettime.c @@ -31,6 +31,18 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts) switch (clock_id) { + case CLOCK_MONOTONIC: + { + /* __host_get_uptime64 can only fail if passed an invalid host_t. + __mach_host_self could theoretically fail (producing an + invalid host_t) due to resource exhaustion, but we assume + this will never happen. */ + time_value64_t tv; + __host_get_uptime64 (__mach_host_self (), &tv); + TIME_VALUE64_TO_TIMESPEC (&tv, ts); + return 0; + } + case CLOCK_REALTIME: { /* __host_get_time can only fail if passed an invalid host_t. -- 2.45.2