From: compudj Date: Fri, 13 Aug 2004 18:33:22 +0000 (+0000) Subject: time add and sub performance tweaks X-Git-Tag: v0.12.20~2761 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f31675494449c73316cab60617f51a85e67291c1;p=lttv.git time add and sub performance tweaks git-svn-id: http://ltt.polymtl.ca/svn@728 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index e350cc99..ec4d134b 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -40,12 +40,10 @@ static inline LttTime ltt_time_sub(LttTime t1, LttTime t2) { LttTime res; res.tv_sec = t1.tv_sec - t2.tv_sec; + res.tv_nsec = t1.tv_nsec - t2.tv_nsec; if(t1.tv_nsec < t2.tv_nsec) { res.tv_sec--; - res.tv_nsec = NANOSECONDS_PER_SECOND + t1.tv_nsec - t2.tv_nsec; - } - else { - res.tv_nsec = t1.tv_nsec - t2.tv_nsec; + res.tv_nsec += NANOSECONDS_PER_SECOND; } return res; } @@ -54,8 +52,8 @@ static inline LttTime ltt_time_sub(LttTime t1, LttTime t2) static inline LttTime ltt_time_add(LttTime t1, LttTime t2) { LttTime res; - res.tv_sec = t1.tv_sec + t2.tv_sec; res.tv_nsec = t1.tv_nsec + t2.tv_nsec; + res.tv_sec = t1.tv_sec + t2.tv_sec; if(res.tv_nsec >= NANOSECONDS_PER_SECOND) { res.tv_sec++; res.tv_nsec -= NANOSECONDS_PER_SECOND;