From 14f0dc1b52a098191843210e34111ef4f3333dbd Mon Sep 17 00:00:00 2001 From: Madhanraj Chelladurai Date: Tue, 15 Mar 2016 09:39:05 +0530 Subject: [PATCH] gps: consider nsec while ranking the timer objects We need to consider nsec as well while ranking timer objects Change-Id: Ieaad5dfa80b26b90e998618b3cbe1e590fc00839 CRs-Fixed: 991345 --- utils/LocTimer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp index 70904b2a..4de6b40b 100644 --- a/utils/LocTimer.cpp +++ b/utils/LocTimer.cpp @@ -505,8 +505,13 @@ int LocTimerDelegate::ranks(LocRankable& rankable) { LocTimerDelegate* timer = (LocTimerDelegate*)(&rankable); if (timer) { // larger time ranks lower!!! - // IOW, if input obj has bigger tv_sec, this obj outRanks higher + // IOW, if input obj has bigger tv_sec/tv_nsec, this obj outRanks higher rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec; + if(0 == rank) + { + //rank against tv_nsec for msec accuracy + rank = (int)(timer->mFutureTime.tv_nsec - mFutureTime.tv_nsec); + } } return rank; }