Skip to content
Snippets Groups Projects
Commit 7b2af2e4 authored by Christoph Pohl's avatar Christoph Pohl
Browse files

Allow for usage of different clocks in armarx::rtNow()

parent b878aa0e
No related branches found
No related tags found
No related merge requests found
...@@ -36,11 +36,11 @@ namespace armarx ...@@ -36,11 +36,11 @@ namespace armarx
} // namespace rt_timing::constants } // namespace rt_timing::constants
inline IceUtil::Time inline IceUtil::Time
rtNow() rtNow(clockid_t clockId = CLOCK_MONOTONIC_RAW)
{ {
using namespace rt_timing::constants; using namespace rt_timing::constants;
struct timespec ts; struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts); clock_gettime(clockId, &ts);
return IceUtil::Time::microSeconds(ts.tv_sec * seconds2MicroSeconds + return IceUtil::Time::microSeconds(ts.tv_sec * seconds2MicroSeconds +
ts.tv_nsec / nanoSeconds2MicroSeconds); ts.tv_nsec / nanoSeconds2MicroSeconds);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment