+/* Time operation macros for LttTime (struct timespec) */
+/* (T3 = T2 - T1) */
+#define TimeSub(T3, T2, T1) \
+do \
+{\
+ (T3).tv_sec = (T2).tv_sec - (T1).tv_sec; \
+ if((T2).tv_nsec < (T1).tv_nsec)\
+ {\
+ (T3).tv_sec--;\
+ (T3).tv_nsec = NANSECOND_CONST - (T1).tv_nsec + (T2).tv_nsec;\
+ }\
+ else\
+ {\
+ (T3).tv_nsec = (T2).tv_nsec - (T1).tv_nsec;\
+ }\
+} while(0)
+
+/* (T3 = T2 + T1) */
+#define TimeAdd(T3, T2, T1) \
+do \
+{\
+ (T3).tv_sec = (T2).tv_sec + (T1).tv_sec; \
+ (T3).tv_nsec = (T2).tv_nsec + (T1).tv_nsec; \
+ if((T3).tv_nsec >= NANSECOND_CONST)\
+ {\
+ (T3).tv_sec += (T3).tv_nsec / NANSECOND_CONST;\
+ (T3).tv_nsec = (T3).tv_nsec % NANSECOND_CONST;\
+ }\
+} 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 >= NANSECOND_CONST)\
+ {\
+ (T2).tv_sec += (T2).tv_nsec / NANSECOND_CONST;\
+ (T2).tv_nsec = (T2).tv_nsec % NANSECOND_CONST;\
+ }\
+} while(0)
+
+