summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretodabsolutetimeout.c
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2016-06-23 16:55:38 -0400
committerGedare Bloom <gedare@rtems.org>2016-07-25 12:44:47 -0400
commitb5bfaaf9c27996d672f7aad67fee24581ab2f218 (patch)
tree6504cee5972cd9003f5b36c58e4d94a020fde9fa /cpukit/score/src/coretodabsolutetimeout.c
parentposix: refactor cond wait support to defer abstime conversion (diff)
downloadrtems-b5bfaaf9c27996d672f7aad67fee24581ab2f218.tar.bz2
posix: cond_timedwait remember and use clock from condattr
updates #2745
Diffstat (limited to 'cpukit/score/src/coretodabsolutetimeout.c')
-rw-r--r--cpukit/score/src/coretodabsolutetimeout.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpukit/score/src/coretodabsolutetimeout.c b/cpukit/score/src/coretodabsolutetimeout.c
index 6c9ffc22d5..fe74a6bbf2 100644
--- a/cpukit/score/src/coretodabsolutetimeout.c
+++ b/cpukit/score/src/coretodabsolutetimeout.c
@@ -25,13 +25,13 @@
*/
TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
const struct timespec *abstime,
+ clockid_t clock,
Watchdog_Interval *ticks_out
)
{
struct timespec current_time;
struct timespec difference;
-
/*
* Make sure there is always a value returned.
*/
@@ -46,7 +46,12 @@ TOD_Absolute_timeout_conversion_results _TOD_Absolute_timeout_to_ticks(
/*
* Is the absolute time in the past?
*/
- _TOD_Get_as_timespec( &current_time );
+ if ( clock == CLOCK_REALTIME ) {
+ _TOD_Get_as_timespec( &current_time );
+ } else {
+ _Assert( clock == CLOCK_MONOTONIC );
+ _TOD_Get_zero_based_uptime_as_timespec( &current_time );
+ }
if ( _Timespec_Less_than( abstime, &current_time ) )
return TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST;