Udostępnij za pośrednictwem


Location.Time Property

Definition

Returns the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1, 1970 UTC). -or- Sets the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1 1970 UTC).

public virtual long Time { [Android.Runtime.Register("getTime", "()J", "GetGetTimeHandler")] get; [Android.Runtime.Register("setTime", "(J)V", "GetSetTime_JHandler")] set; }
[<get: Android.Runtime.Register("getTime", "()J", "GetGetTimeHandler")>]
[<set: Android.Runtime.Register("setTime", "(J)V", "GetSetTime_JHandler")>]
member this.Time : int64 with get, set

Property Value

the Unix epoch time of this location

Attributes

Remarks

Property getter documentation:

Returns the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1, 1970 UTC).

There is no guarantee that different locations have times set from the same clock. Locations derived from the LocationManager#GPS_PROVIDER are guaranteed to have their time originate from the clock in use by the satellite constellation that provided the fix. Locations derived from other providers may use any clock to set their time, though it is most common to use the device's Unix epoch time system clock (which may be incorrect).

Note that the device's Unix epoch time system clock is not monotonic; it can jump forwards or backwards unpredictably and may be changed at any time by the user, so this time should not be used to order or compare locations. Prefer #getElapsedRealtimeNanos for that purpose, as the elapsed realtime clock is guaranteed to be monotonic.

On the other hand, this method may be useful for presenting a human-readable time to the user, or as a heuristic for comparing location fixes across reboot or across devices.

All locations generated by the LocationManager are guaranteed to have this time set, however remember that the device's system clock may have changed since the location was generated.

Java documentation for android.location.Location.getTime().

Property setter documentation:

Sets the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1 1970 UTC).

Java documentation for android.location.Location.setTime(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to