summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretodget.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src/coretodget.c')
-rw-r--r--cpukit/score/src/coretodget.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c
index 1d48082f26..dff46a0748 100644
--- a/cpukit/score/src/coretodget.c
+++ b/cpukit/score/src/coretodget.c
@@ -18,6 +18,7 @@
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/timespec.h>
+#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
@@ -36,20 +37,22 @@ void _TOD_Get(
struct timespec *time
)
{
- ISR_Level level;
- struct timespec offset;
+ ISR_Level level;
+ Timestamp_Control offset;
+ Timestamp_Control now;
+ long nanoseconds;
- /* assume time checked by caller */
+ /* assume time checked for NULL by caller */
- offset.tv_sec = 0;
- offset.tv_nsec = 0;
-
- /* _TOD_Now is a proper POSIX time */
+ /* _TOD_Now is the native current time */
+ nanoseconds = 0;
_ISR_Disable( level );
- *time = _TOD_Now;
+ now = _TOD_Now;
if ( _Watchdog_Nanoseconds_since_tick_handler )
- offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
+ nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)();
_ISR_Enable( level );
- _Timespec_Add_to( time, &offset );
+ _Timestamp_Set( &offset, 0, nanoseconds );
+ _Timestamp_Add_to( &now, &offset );
+ _Timestamp_To_timespec( &now, time );
}