summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-20 15:23:49 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-24 09:37:28 +0200
commitb13ec804763d8f428161a50fd1846d567982ed4b (patch)
treecc83e17d326ba9ce62a5dec00af050f36de559ac /cpukit/score/include
parentcea5ff700166a24b5da300cf0aa6884164600ed3 (diff)
downloadrtems-b13ec804763d8f428161a50fd1846d567982ed4b.tar.bz2
score: Add _Watchdog_Monotonic_from_timespec()
Update #3117. Update #3182.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/watchdogimpl.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h
index 31b44f1d0b..b3f396b7a3 100644
--- a/cpukit/score/include/rtems/score/watchdogimpl.h
+++ b/cpukit/score/include/rtems/score/watchdogimpl.h
@@ -326,6 +326,22 @@ RTEMS_INLINE_ROUTINE bool _Watchdog_Is_far_future_monotonic_timespec(
return ts->tv_sec >= _Watchdog_Monotonic_max_seconds;
}
+RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Monotonic_from_timespec(
+ const struct timespec *ts
+)
+{
+ uint64_t ticks;
+
+ _Assert( _Watchdog_Is_valid_timespec( ts ) );
+ _Assert( ts->tv_sec >= 0 );
+ _Assert( !_Watchdog_Is_far_future_monotonic_timespec( ts ) );
+
+ ticks = (uint64_t) ts->tv_sec * _Watchdog_Ticks_per_second;
+ ticks += (unsigned long) ts->tv_nsec / _Watchdog_Nanoseconds_per_tick;
+
+ return ticks;
+}
+
RTEMS_INLINE_ROUTINE bool _Watchdog_Is_far_future_realtime_timespec(
const struct timespec *ts
)