Reduce the computation between current time and last sync time 62/240162/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Aug 2020 05:24:26 +0000 (14:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Aug 2020 05:24:26 +0000 (14:24 +0900)
Change-Id: Ib8b4f4132de13797b945ab4ba4eeaf3317c78cd2
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/main.cpp

index 8e04807..8f40413 100644 (file)
@@ -101,15 +101,16 @@ static bool check_sync_time_condition()
         }
 
         // compare time
-        LOGD("current time : %f, last_sync_time : %f", ecore_time_unix_get(), last_sync_time);
+        double timediff = ecore_time_unix_get() - last_sync_time;
+        LOGD("current time : %.3f, last_sync_time : %.3f, diff : %.3f", ecore_time_unix_get(), last_sync_time, timediff);
 
-        if (ecore_time_unix_get() - last_sync_time > MAX_WAIT_TIME) {
+        if (timediff > MAX_WAIT_TIME) {
             LOGD("Starting manual synchronization");
             initialize_sap();
             request_show_sync_notification();
             result = false;
         } else {
-            if (ecore_time_unix_get() - last_sync_time > SYNC_INTERVAL)
+            if (timediff > SYNC_INTERVAL)
                 result = true;
             else
                 result = false;