OSDN Git Service

Print timestamp (instead of age) in Location#toString()
authorNick Pelly <npelly@google.com>
Mon, 20 Aug 2012 21:40:24 +0000 (14:40 -0700)
committerNick Pelly <npelly@google.com>
Tue, 21 Aug 2012 20:52:20 +0000 (13:52 -0700)
Age was a bad idea, since it depends when toString() was called

Change-Id: Ica0b6bfa9a93b5a452ba3def5fbb2b0a0194c401

location/java/android/location/Location.java

index f50ee82..40cb1a8 100644 (file)
@@ -825,9 +825,8 @@ public class Location implements Parcelable {
         if (mElapsedRealtimeNano == 0) {
             s.append(" et=?!?");
         } else {
-            long age = SystemClock.elapsedRealtimeNano() - mElapsedRealtimeNano;
-            s.append(" age=");
-            TimeUtils.formatDuration(age / 1000000L, s);
+            s.append(" et=");
+            TimeUtils.formatDuration(mElapsedRealtimeNano / 1000000L, s);
         }
         if (mHasAltitude) s.append(" alt=").append(mAltitude);
         if (mHasSpeed) s.append(" vel=").append(mSpeed);