From: yangxx Date: Thu, 31 Jul 2003 20:14:52 +0000 (+0000) Subject: git-svn-id: http://ltt.polymtl.ca/svn@151 04897980-b3bd-0310-b5e0-8ef037075253 X-Git-Tag: v0.12.20~3338 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=370dd87e2c9883b15999cab93d93762fec94b255;p=lttv.git git-svn-id: ltt.polymtl.ca/svn@151 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/include/ltt/ltt.h b/ltt/branches/poly/include/ltt/ltt.h index eda0a766..17303a08 100644 --- a/ltt/branches/poly/include/ltt/ltt.h +++ b/ltt/branches/poly/include/ltt/ltt.h @@ -94,6 +94,33 @@ typedef enum _LttArchEndian { LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN } LttArchEndian; +/* 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; \ + (T3).tv_nsec = (T2).tv_nsec - (T1).tv_nsec; \ + if((T3).tv_nsec < 0)\ + {\ + (T3).tv_sec--;\ + (T3).tv_nsec += 1000000000;\ + }\ +} 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 >= 1000000000)\ + {\ + (T3).tv_sec += (T3).tv_nsec / 1000000000;\ + (T3).tv_nsec = (T3).tv_nsec % 1000000000;\ + }\ +} while(0) + #include