2009-08-17 Joel Sherrill <joel.sherrill@OARcorp.com>

* rtems/src/clockget.c: Restructure to ease coverage analysis of
	deprecated routine.
This commit is contained in:
Joel Sherrill
2009-08-17 13:31:20 +00:00
parent 400a04a200
commit e0d71f7a56
2 changed files with 25 additions and 24 deletions

View File

@@ -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.

View File

@@ -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 );
default:
break;
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;
}
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;
}