diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-17 13:31:20 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-17 13:31:20 +0000 |
commit | e0d71f7a5668bca64ff72e9621bc95bd9b50bfa6 (patch) | |
tree | 9270ee5306071d0af83b970ec11d0338aad8f1e6 /cpukit | |
parent | 2009-08-16 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-e0d71f7a5668bca64ff72e9621bc95bd9b50bfa6.tar.bz2 |
2009-08-17 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/src/clockget.c: Restructure to ease coverage analysis of
deprecated routine.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/rtems/src/clockget.c | 42 |
2 files changed, 24 insertions, 23 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 89bb955b36..a249f925c0 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2009-08-17 Joel Sherrill <joel.sherrill@OARcorp.com> + + * rtems/src/clockget.c: Restructure to ease coverage analysis of + deprecated routine. + 2009-08-16 Joel Sherrill <joel.sherrill@oarcorp.com> * libi2c/libi2c.c: Fix warnings. diff --git a/cpukit/rtems/src/clockget.c b/cpukit/rtems/src/clockget.c index 0009d47fb3..bebc100fd6 100644 --- a/cpukit/rtems/src/clockget.c +++ b/cpukit/rtems/src/clockget.c @@ -1,7 +1,7 @@ /* * Clock Manager * - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -23,8 +23,7 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/*PAGE - * +/* * rtems_clock_get * * This directive returns the current date and time. If the time has @@ -49,32 +48,29 @@ rtems_status_code rtems_clock_get( if ( !time_buffer ) return RTEMS_INVALID_ADDRESS; - switch ( option ) { - case RTEMS_CLOCK_GET_TOD: - return rtems_clock_get_tod( (rtems_time_of_day *)time_buffer ); + if ( option == RTEMS_CLOCK_GET_TOD ) + return rtems_clock_get_tod( (rtems_time_of_day *)time_buffer ); - case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: + if ( option == RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH ) return rtems_clock_get_seconds_since_epoch((rtems_interval *)time_buffer); - case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: { - rtems_interval *interval = (rtems_interval *)time_buffer; - - *interval = rtems_clock_get_ticks_since_boot(); - return RTEMS_SUCCESSFUL; - } - case RTEMS_CLOCK_GET_TICKS_PER_SECOND: { - rtems_interval *interval = (rtems_interval *)time_buffer; - - *interval = rtems_clock_get_ticks_per_second(); - return RTEMS_SUCCESSFUL; - } - case RTEMS_CLOCK_GET_TIME_VALUE: - return rtems_clock_get_tod_timeval( (struct timeval *)time_buffer ); + if ( option == RTEMS_CLOCK_GET_TICKS_SINCE_BOOT ) { + rtems_interval *interval = (rtems_interval *)time_buffer; + + *interval = rtems_clock_get_ticks_since_boot(); + return RTEMS_SUCCESSFUL; + } - default: - break; + if ( option == RTEMS_CLOCK_GET_TICKS_PER_SECOND ) { + rtems_interval *interval = (rtems_interval *)time_buffer; + + *interval = rtems_clock_get_ticks_per_second(); + return RTEMS_SUCCESSFUL; } + if ( option == RTEMS_CLOCK_GET_TIME_VALUE ) + return rtems_clock_get_tod_timeval( (struct timeval *)time_buffer ); + return RTEMS_INVALID_NUMBER; } |