From: compudj Date: Sat, 14 Aug 2004 20:36:28 +0000 (+0000) Subject: tweak ltt_time_compare X-Git-Tag: v0.12.20~2735 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=280f99688d68d83b8d1099b2f6bcc4579da771b0;p=lttv.git tweak ltt_time_compare git-svn-id: http://ltt.polymtl.ca/svn@754 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index 83c2fb6c..55fb5883 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -63,13 +63,16 @@ static inline LttTime ltt_time_add(LttTime t1, LttTime t2) } +/* Fastest comparison : t1 > t2 */ static inline int ltt_time_compare(LttTime t1, LttTime t2) { - if(t1.tv_sec > t2.tv_sec) return 1; - if(t1.tv_sec < t2.tv_sec) return -1; - if(t1.tv_nsec > t2.tv_nsec) return 1; - if(t1.tv_nsec < t2.tv_nsec) return -1; - return 0; + int ret=0; + if(t1.tv_sec > t2.tv_sec) ret = 1; + else if(t1.tv_sec < t2.tv_sec) ret = -1; + else if(t1.tv_nsec > t2.tv_nsec) ret = 1; + else if(t1.tv_nsec < t2.tv_nsec) ret = -1; + + return ret; } #define LTT_TIME_MIN(a,b) ((ltt_time_compare((a),(b)) < 0) ? (a) : (b))