hairo
Dependencies: mbed BufferedSerial
Diff: ros/time.h
- Revision:
- 1:a849bf78d77f
- Parent:
- 0:9e9b7db60fd5
diff -r 9e9b7db60fd5 -r a849bf78d77f ros/time.h --- a/ros/time.h Sat Dec 31 00:48:34 2016 +0000 +++ b/ros/time.h Sat Dec 31 00:59:58 2016 +0000 @@ -54,6 +54,7 @@ normalizeSecNSec(sec, nsec); } + double round(double number) { return number < 0.0 ? ceil(number - 0.5): floor(number + 0.5); } double toSec() const { return (double)sec + 1e-9*(double)nsec; }; void fromSec(double t) { sec = (uint32_t) floor(t); nsec = (uint32_t) round((t-sec) * 1e9); };