public final class GpsTimeConverter extends Object
The GPS to Java time transition is complicated somewhat by the effect that the conversation may actually produce the same Java value for two different GPS times. For example, there was a leap second at the transition from 30 June to 1 July in 2015. Thus the GPS times 1119744016 and 1119744017 both map to 2015-07-01 00:00:00 UTC.
Modifier and Type | Method and Description |
---|---|
static Date |
gpsToDate(double gpsTime)
Convert a GPS time to a Java Date object which represents time in
milliseconds since the Java epoch 1 January 1970.
|
static long |
gpsToMillis(double gpsTime)
Convert a GPS time to milliseconds since the Java epoch 1 January 1970.
|
public static long gpsToMillis(double gpsTime)
Note that the GPS time is based on the Epoch 6 January 1980 while the milliseconds system is based on the Epoch 1 January 1970. So a GPS time of zero will have value milliseconds value of 315964800000.
This routine does not handle leap seconds in the period before 1980, thus negative gpsTime values will not be adjusted for leap seconds.
gpsTime
- a valid positive number giving a GPS time in seconds
measured from the GPS epoch 6 January 1980.public static Date gpsToDate(double gpsTime)
gpsTime
- a valid positive number giving a GPS time in seconds
measured from the GPS epoch 6 January 1980.Copyright © 2021. All rights reserved.