modify for Hydro version

Dependencies:   MODSERIAL

Fork of rosserial_mbed_lib by nucho

Revision:
5:8cd48977ec68
Parent:
3:1cf99502f396
--- a/ros/duration.h	Wed Feb 29 23:00:21 2012 +0000
+++ b/ros/duration.h	Sat Oct 26 15:38:35 2013 +0000
@@ -35,6 +35,8 @@
 #ifndef _ROS_DURATION_H_
 #define _ROS_DURATION_H_
 
+#include <math.h>
+
 namespace ros {
 
   void normalizeSecNSecSigned(long& sec, long& nsec);
@@ -50,6 +52,9 @@
         normalizeSecNSecSigned(sec, nsec);
       }
 
+      double toSec() const { return (double)sec + 1e-9*(double)nsec; };
+      void fromSec(double t) { sec = (unsigned long) floor(t); nsec = (unsigned long) rint((t-sec) * 1e9); };
+
       Duration& operator+=(const Duration &rhs);
       Duration& operator-=(const Duration &rhs);
       Duration& operator*=(double scale);
@@ -58,3 +63,5 @@
 }
 
 #endif
+
+