Revision a92c8621
client/cpp/include/RobotTimestamp.h | ||
---|---|---|
38 | 38 |
nsec = n.nsec; |
39 | 39 |
} |
40 | 40 |
|
41 |
RobotTimestamp(int32_t _sec, int32_t _nsec) { |
|
42 |
sec = _sec; |
|
43 |
nsec = _nsec; |
|
44 |
} |
|
45 |
|
|
41 | 46 |
static RobotTimestamp now(){ |
42 |
RobotTimestamp res; |
|
43 |
//fetch time |
|
47 |
// fetch time |
|
44 | 48 |
struct timespec tp; |
45 | 49 |
clock_gettime(CLOCK_REALTIME, &tp); |
46 |
res.sec = tp.tv_sec; |
|
47 |
res.nsec = tp.tv_nsec;
|
|
50 |
|
|
51 |
RobotTimestamp res(tp.tv_sec, tp.tv_nsec);
|
|
48 | 52 |
return res; |
49 | 53 |
}; |
50 | 54 |
|
Also available in: Unified diff