From dee971b98c3b084af54ae2f42b6fa3d4734d58d9 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Wed, 11 Sep 2013 15:21:10 -0700 Subject: Fix Batched Scan Results to give Timestamp in uS ScanResult should have timestamp in uS but we are getting age in ms from the wifi driver - multiply to have the same units though not the implied precision. bug: 10410465 Change-Id: Idf5c5996d69a4793dae3d74edb790d40b9bd3298 --- wifi/java/android/net/wifi/WifiStateMachine.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'wifi') diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 0f1aa71..ad89716 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -65,6 +65,7 @@ import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.os.WorkSource; @@ -1016,7 +1017,7 @@ public class WifiStateMachine extends StateMachine { int dist, distSd; long tsf = 0; dist = distSd = ScanResult.UNSPECIFIED; - long now = System.currentTimeMillis(); + long now = SystemClock.elapsedRealtime(); while (true) { while (n < splitData.length) { @@ -1064,6 +1065,7 @@ public class WifiStateMachine extends StateMachine { } else if (splitData[n].startsWith(AGE)) { try { tsf = now - Long.parseLong(splitData[n].substring(AGE.length())); + tsf *= 1000; // convert mS -> uS } catch (NumberFormatException e) { loge("Invalid timestamp: " + splitData[n]); tsf = 0; -- cgit v1.1