diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-16 14:02:12 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-21 16:29:36 +0100 |
commit | bfddb0478ce8777cad63e15d185994b433fdcf8d (patch) | |
tree | ef977416325ba1acf7e2b08e208b123f13e3b420 /cpukit/rtems | |
parent | score: Add and use _TOD_Get_with_nanoseconds() (diff) | |
download | rtems-bfddb0478ce8777cad63e15d185994b433fdcf8d.tar.bz2 |
rtems: Add rtems_clock_get_uptime_timeval()
Diffstat (limited to 'cpukit/rtems')
-rw-r--r-- | cpukit/rtems/Makefile.am | 1 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/clock.h | 7 | ||||
-rw-r--r-- | cpukit/rtems/src/clockgetuptimetimeval.c | 27 |
3 files changed, 35 insertions, 0 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am index ff3174ebbc..10a5cfaf5d 100644 --- a/cpukit/rtems/Makefile.am +++ b/cpukit/rtems/Makefile.am @@ -154,6 +154,7 @@ librtems_a_SOURCES += src/clockgettickssinceboot.c librtems_a_SOURCES += src/clockgettod.c librtems_a_SOURCES += src/clockgettodtimeval.c librtems_a_SOURCES += src/clockgetuptime.c +librtems_a_SOURCES += src/clockgetuptimetimeval.c librtems_a_SOURCES += src/clockset.c librtems_a_SOURCES += src/clocksetnsecshandler.c librtems_a_SOURCES += src/clocktick.c diff --git a/cpukit/rtems/include/rtems/rtems/clock.h b/cpukit/rtems/include/rtems/rtems/clock.h index 92f02c34ce..9805f58e10 100644 --- a/cpukit/rtems/include/rtems/rtems/clock.h +++ b/cpukit/rtems/include/rtems/rtems/clock.h @@ -228,6 +228,13 @@ rtems_status_code rtems_clock_get_uptime( ); /** + * @brief Gets the system uptime in the struct timeval format. + * + * @param[out] Returns the system uptime. Pointer must not be NULL. + */ +void rtems_clock_get_uptime_timeval( struct timeval *uptime ); + +/** * @brief _TOD_Validate * * This support function returns true if @a the_tod contains diff --git a/cpukit/rtems/src/clockgetuptimetimeval.c b/cpukit/rtems/src/clockgetuptimetimeval.c new file mode 100644 index 0000000000..8ecd2fbc4d --- /dev/null +++ b/cpukit/rtems/src/clockgetuptimetimeval.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include <rtems/rtems/clock.h> + +void rtems_clock_get_uptime_timeval( struct timeval *uptime ) +{ + Timestamp_Control snapshot_as_timestamp; + + _TOD_Get_uptime( &snapshot_as_timestamp ); + _Timestamp_To_timeval( &snapshot_as_timestamp, uptime ); +} |