mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-06 12:01:08 +03:00
time: Add TIME_MONOTONIC, TIME_ACTIVE, and TIME_THREAD_ACTIVE
The TIME_MONOTONIC maps to POSIX's CLOCK_MONOTONIC, TIME_ACTIVE to CLOCK_PROCESS_CPUTIME_ID, and TIME_THREAD_ACTIVE to CLOCK_THREAD_CPUTIME_ID. No Linux specific timer are added as extension. Co-authored-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
This commit is contained in:
@@ -22,12 +22,7 @@
|
||||
int
|
||||
__timespec_getres64 (struct __timespec64 *ts, int base)
|
||||
{
|
||||
if (base == TIME_UTC)
|
||||
{
|
||||
__clock_getres64 (CLOCK_REALTIME, ts);
|
||||
return base;
|
||||
}
|
||||
return 0;
|
||||
return __clock_getres64 (clock_from_timebase (base), ts) == 0 ? base : 0;
|
||||
}
|
||||
|
||||
#if __TIMESIZE != 64
|
||||
@@ -40,8 +35,7 @@ __timespec_getres (struct timespec *ts, int base)
|
||||
struct __timespec64 tp64;
|
||||
|
||||
ret = __timespec_getres64 (&tp64, base);
|
||||
|
||||
if (ret == TIME_UTC && ts != NULL)
|
||||
if (ret != 0 && ts != NULL)
|
||||
*ts = valid_timespec64_to_timespec (tp64);
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user