From f31675494449c73316cab60617f51a85e67291c1 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 13 Aug 2004 18:33:22 +0000 Subject: [PATCH] time add and sub performance tweaks git-svn-id: http://ltt.polymtl.ca/svn@728 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/time.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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; -- 2.34.1