git-svn-id: http://ltt.polymtl.ca/svn@235 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / include / ltt / ltt.h
index 17303a08922b1ef52ceabae27854f0a8ac786968..1da397f365d7f8e816fa87a363fd242008139764 100644 (file)
@@ -75,7 +75,10 @@ typedef unsigned long LttChecksum;
    times per second) of the real time clock with their corresponding 
    cycle count values. */
 
-typedef struct timespec LttTime;
+typedef struct _LttTime {
+  unsigned long tv_sec;
+  unsigned long tv_nsec;
+} LttTime;
 
 typedef uint64_t LttCycleCount;
 
@@ -121,6 +124,23 @@ do \
     }\
 } while(0)
 
+/*  (T2 = T1 * FLOAT) */
+/* WARNING : use this multiplicator carefully : on 32 bits, multiplying
+ * by more than 4 could overflow the tv_nsec.
+ */
+#define TimeMul(T2, T1, FLOAT) \
+do \
+{\
+  (T2).tv_sec  = (T1).tv_sec  * (FLOAT);  \
+  (T2).tv_nsec = (T1).tv_nsec * (FLOAT);  \
+  if((T2).tv_nsec >= 1000000000)\
+    {\
+    (T2).tv_sec += (T2).tv_nsec / 1000000000;\
+    (T2).tv_nsec = (T2).tv_nsec % 1000000000;\
+    }\
+} while(0)
+
+
 
 
 #include <ltt/ltt-private.h>
This page took 0.022218 seconds and 4 git commands to generate.