diff options
author | Alexander Krutwig <alexander.krutwig@embedded-brains.de> | 2015-05-12 14:32:47 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-20 08:40:33 +0200 |
commit | 7cd2484c4cf9fc759b7205ed6d8adcc6d2c28ff6 (patch) | |
tree | dd60b6032354124d97233e7070506f09d1566832 /cpukit/posix | |
parent | timecounter: Port to RTEMS (diff) | |
download | rtems-7cd2484c4cf9fc759b7205ed6d8adcc6d2c28ff6.tar.bz2 |
timecounter: Use in RTEMS
Replace timestamp implementation with FreeBSD bintime and timecounters.
New test sptests/sptimecounter02.
Update #2271.
Diffstat (limited to 'cpukit/posix')
-rw-r--r-- | cpukit/posix/src/clockgettime.c | 8 | ||||
-rw-r--r-- | cpukit/posix/src/posixtimespecabsolutetimeout.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timergettime.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timersettime.c | 4 | ||||
-rw-r--r-- | cpukit/posix/src/timertsr.c | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/cpukit/posix/src/clockgettime.c b/cpukit/posix/src/clockgettime.c index 2838ba657e..83a35d769a 100644 --- a/cpukit/posix/src/clockgettime.c +++ b/cpukit/posix/src/clockgettime.c @@ -37,19 +37,21 @@ int clock_gettime( rtems_set_errno_and_return_minus_one( EINVAL ); if ( clock_id == CLOCK_REALTIME ) { - _TOD_Get(tp); + _TOD_Get_as_timespec(tp); return 0; } #ifdef CLOCK_MONOTONIC if ( clock_id == CLOCK_MONOTONIC ) { - _TOD_Get_uptime_as_timespec( tp ); + _TOD_Get_zero_based_uptime_as_timespec( tp ); + --tp->tv_sec; return 0; } #endif #ifdef _POSIX_CPUTIME if ( clock_id == CLOCK_PROCESS_CPUTIME_ID ) { - _TOD_Get_uptime_as_timespec( tp ); + _TOD_Get_zero_based_uptime_as_timespec( tp ); + --tp->tv_sec; return 0; } #endif diff --git a/cpukit/posix/src/posixtimespecabsolutetimeout.c b/cpukit/posix/src/posixtimespecabsolutetimeout.c index 32da45f3ae..f3029861d1 100644 --- a/cpukit/posix/src/posixtimespecabsolutetimeout.c +++ b/cpukit/posix/src/posixtimespecabsolutetimeout.c @@ -57,7 +57,7 @@ POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( /* * Is the absolute time in the past? */ - _TOD_Get( ¤t_time ); + _TOD_Get_as_timespec( ¤t_time ); if ( _Timespec_Less_than( abstime, ¤t_time ) ) return POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST; diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c index 2a810ef42d..f065cc927c 100644 --- a/cpukit/posix/src/timergettime.c +++ b/cpukit/posix/src/timergettime.c @@ -49,7 +49,7 @@ int timer_gettime( rtems_set_errno_and_return_minus_one( EINVAL ); /* Reads the current time */ - _TOD_Get( ¤t_time ); + _TOD_Get_as_timespec( ¤t_time ); ptimer = _POSIX_Timer_Get( timerid, &location ); switch ( location ) { diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c index 2967df6df0..2a8cec7652 100644 --- a/cpukit/posix/src/timersettime.c +++ b/cpukit/posix/src/timersettime.c @@ -66,7 +66,7 @@ int timer_settime( /* Convert absolute to relative time */ if (flags == TIMER_ABSTIME) { struct timespec now; - _TOD_Get( &now ); + _TOD_Get_as_timespec( &now ); /* Check for seconds in the past */ if ( _Timespec_Greater_than( &now, &normalize.it_value ) ) rtems_set_errno_and_return_minus_one( EINVAL ); @@ -125,7 +125,7 @@ int timer_settime( /* Indicate that the time is running */ ptimer->state = POSIX_TIMER_STATE_CREATE_RUN; - _TOD_Get( &ptimer->time ); + _TOD_Get_as_timespec( &ptimer->time ); _Objects_Put( &ptimer->Object ); return 0; diff --git a/cpukit/posix/src/timertsr.c b/cpukit/posix/src/timertsr.c index 85554633e9..512dd06d38 100644 --- a/cpukit/posix/src/timertsr.c +++ b/cpukit/posix/src/timertsr.c @@ -58,7 +58,7 @@ void _POSIX_Timer_TSR( return; /* Store the time when the timer was started again */ - _TOD_Get( &ptimer->time ); + _TOD_Get_as_timespec( &ptimer->time ); /* The state really did not change but just to be safe */ ptimer->state = POSIX_TIMER_STATE_CREATE_RUN; |