diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-16 13:39:55 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-21 16:24:22 +0100 |
commit | 154721c4348084e1b2ae96cd7f2ec824f27c345a (patch) | |
tree | 889634e37035a87f75a4b8647a382e4f8e791e91 /cpukit/score/include/rtems/score/timestamp.h | |
parent | bsp/mpc55xx: Update due to API changes (diff) | |
download | rtems-154721c4348084e1b2ae96cd7f2ec824f27c345a.tar.bz2 |
score: Add _Timestamp_To_timeval()
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/include/rtems/score/timestamp.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/timestamp.h b/cpukit/score/include/rtems/score/timestamp.h index 83948b46e1..fb16886947 100644 --- a/cpukit/score/include/rtems/score/timestamp.h +++ b/cpukit/score/include/rtems/score/timestamp.h @@ -38,6 +38,8 @@ */ /**@{*/ +#include <sys/time.h> + #include <rtems/score/cpu.h> #include <rtems/score/timespec.h> @@ -342,6 +344,23 @@ extern "C" { _Timestamp64_To_timespec( _timestamp, _timespec ) #endif +/** + * @brief Convert Timestamp to struct timeval + * + * @param[in] _timestamp points to the timestamp + * @param[in] _timeval points to the timeval + */ +#if CPU_TIMESTAMP_USE_STRUCT_TIMESPEC == TRUE + #define _Timestamp_To_timeval( _timestamp, _timeval ) \ + do { \ + (_timeval)->tv_sec = (_timestamp)->tv_sec; \ + (_timeval)->tv_usec = (_timestamp)->tv_nsec / 1000; \ + } while (0) +#else + #define _Timestamp_To_timeval( _timestamp, _timeval ) \ + _Timestamp64_To_timeval( _timestamp, _timeval ) +#endif + #ifdef __cplusplus } #endif |