mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 08:36:28 +03:00
Raw support for COARSE clocks
This commit is contained in:
@@ -87,6 +87,13 @@ typedef int clockid_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CLOCK_REALTIME_COARSE
|
||||
#define CLOCK_REALTIME_COARSE CLOCK_REALTIME
|
||||
#endif
|
||||
#ifndef CLOCK_MONOTONIC_COARSE
|
||||
#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
|
||||
#endif
|
||||
|
||||
/* some systems lack raw clock */
|
||||
#ifndef CLOCK_MONOTONIC_RAW
|
||||
#define CLOCK_MONOTONIC_RAW (CLOCK_MONOTONIC + 1)
|
||||
@@ -1913,9 +1920,11 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
switch (clk_id)
|
||||
{
|
||||
case CLOCK_REALTIME:
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
timespecsub(tp, &ftpl_starttime.real, &tmp_ts);
|
||||
break;
|
||||
case CLOCK_MONOTONIC:
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
timespecsub(tp, &ftpl_starttime.mon, &tmp_ts);
|
||||
break;
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
@@ -2053,9 +2062,11 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
switch (clk_id)
|
||||
{
|
||||
case CLOCK_REALTIME:
|
||||
case CLOCK_REALTIME_COARSE:
|
||||
timespecsub(tp, &ftpl_starttime.real, &tdiff);
|
||||
break;
|
||||
case CLOCK_MONOTONIC:
|
||||
case CLOCK_MONOTONIC_COARSE:
|
||||
timespecsub(tp, &ftpl_starttime.mon, &tdiff);
|
||||
break;
|
||||
case CLOCK_MONOTONIC_RAW:
|
||||
|
||||
Reference in New Issue
Block a user