Raw support for COARSE clocks

This commit is contained in:
Azat Khuzhin
2015-12-28 16:54:55 +03:00
parent 18f5ec0671
commit 4398deaa3d

View File

@@ -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: