Changeset 875fff0a in rtems
- Timestamp:
- 07/23/14 20:35:35 (8 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 0a84c298
- Parents:
- 3b6352d
- git-author:
- Joel Sherrill <joel.sherrill@…> (07/23/14 20:35:35)
- git-committer:
- Joel Sherrill <joel.sherrill@…> (07/23/14 21:53:24)
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/posix/src/adjtime.c
r3b6352d r875fff0a 45 45 { 46 46 Timestamp_Control delta_as_timestamp; 47 Timestamp_Control tod_as_timestamp;48 Timestamp_Control *tod_as_timestamp_ptr;49 47 50 48 /* … … 54 52 rtems_set_errno_and_return_minus_one( EINVAL ); 55 53 54 if ( delta->tv_usec >= TOD_MICROSECONDS_PER_SECOND ) 55 rtems_set_errno_and_return_minus_one( EINVAL ); 56 56 57 /* 57 * Currently, RTEMS does the adjustment in one movement. 58 * An adjustment of zero is pretty easy. 59 */ 60 if ( delta->tv_sec == 0 && delta->tv_usec == 0 ) 61 return 0; 62 63 /* 64 * Currently, RTEMS does the adjustment in one movement so there 65 * is no way an adjustment was currently underway. 66 * 58 67 * Given interest, requirements, and sponsorship, a future 59 68 * enhancement would be to adjust the time in smaller increments … … 72 81 73 82 /* 74 * This prevents context switches while we are adjusting the TOD83 * Now apply the adjustment 75 84 */ 76 77 _Thread_Disable_dispatch(); 78 79 tod_as_timestamp_ptr = 80 _TOD_Get_with_nanoseconds( &tod_as_timestamp, &_TOD.now ); 81 82 83 _Timestamp_Add_to( tod_as_timestamp_ptr, &delta_as_timestamp ); 84 85 _TOD_Set_with_timestamp( tod_as_timestamp_ptr ); 86 87 _Thread_Enable_dispatch(); 85 _TOD_Adjust( delta_as_timestamp ); 88 86 89 87 return 0; -
cpukit/score/Makefile.am
r3b6352d r875fff0a 320 320 libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \ 321 321 src/coretodgetuptimetimespec.c src/coretodtickle.c \ 322 src/coretodsecondssinceepoch.c \323 src/coretod tickspersec.c322 src/coretodsecondssinceepoch.c src/coretodtickspersec.c \ 323 src/coretodadjust.c 324 324 325 325 ## WATCHDOG_C_FILES -
cpukit/score/include/rtems/score/todimpl.h
r3b6352d r875fff0a 323 323 } 324 324 325 /** 326 * @brief Adjust the Time of Time 327 * 328 * This method is used to adjust the current time of day by the 329 * specified amount. 330 * 331 * @param[in] delta is the amount to adjust 332 */ 333 void _TOD_Adjust( 334 const Timestamp_Control timestamp 335 ); 336 325 337 RTEMS_INLINE_ROUTINE void _TOD_Set_nanoseconds_since_last_tick_handler( 326 338 TOD_Nanoseconds_since_last_tick_routine routine -
testsuites/psxtests/psxtime/psxtime.scn
r3b6352d r875fff0a 6 6 adjtime - NULL delta - EINVAL 7 7 adjtime - delta out of range - EINVAL 8 adjtime - delta range of 0 - OK 8 9 adjtime - delta too small - do nothing 9 10 adjtime - delta too small - do nothing, olddelta=NULL -
testsuites/psxtests/psxtime/test.c
r3b6352d r875fff0a 1 /* 2 * This test exercises the time of day services via the Classic 3 * and POSIX APIs to make sure they are consistent. 1 /** 2 * @file 4 3 * 5 * COPYRIGHT (c) 1989-2009. 4 * This test exercises the time of day services via the Classic 5 * and POSIX APIs to make sure they are consistent. It additionally 6 * exericses the adjtime() method. 7 * 8 */ 9 10 /* 11 * COPYRIGHT (c) 1989-2014. 6 12 * On-Line Applications Research Corporation (OAR). 7 13 * … … 129 135 130 136 puts( "adjtime - delta out of range - EINVAL" ); 137 delta.tv_sec = 0; 131 138 delta.tv_usec = 1000000000; /* 100 seconds worth */ 132 139 sc = adjtime( &delta, &olddelta ); 133 140 rtems_test_assert( sc == -1 ); 134 141 rtems_test_assert( errno == EINVAL ); 142 143 puts( "adjtime - delta range of 0 - OK" ); 144 delta.tv_sec = 0; 145 delta.tv_usec = 0; 146 sc = adjtime( &delta, &olddelta ); 147 rtems_test_assert( sc == 0 ); 135 148 136 149 puts( "adjtime - delta too small - do nothing" );
Note: See TracChangeset
for help on using the changeset viewer.