Class GpsTimeConverter


  • public class GpsTimeConverter
    extends Object
    Gps Time converter

    Adapted from the javascript version of: https://losc.ligo.org/gps/

    Following may be helpful for conversion when new leap seconds are announced.

     gnu 'date':
     date --date='2012-06-30 23:59:59' +%s
     

    source: https://losc.ligo.org/s/js/gpstimeutil.js

    GPS time was born at the 1/5/1980 to 1/6/1980 midnight. January 6, 1980 is a Sunday. GPS Time counts in weeks and seconds of a week from this instant. The weeks begin at the Saturday/Sunday transition. The days of the week are numbered, with Sunday being 0, Saturday is day 6

    Author:
    Andrea Antonello (www.hydrologis.com)
    • Field Detail

      • ISO8601_pattern

        public static String ISO8601_pattern
      • ISO8601Formatter

        public static org.joda.time.format.DateTimeFormatter ISO8601Formatter
    • Constructor Detail

      • GpsTimeConverter

        public GpsTimeConverter()
    • Method Detail

      • dateTime2gps

        public static double dateTime2gps​(double dateTimeMillis)
        Convert DateTime to GPS Time.
        Parameters:
        dateTimeMillis - the datetime to convert (millis).
        Returns:
        the gps time.
      • gpsWeekTime2DateTime

        public static org.joda.time.DateTime gpsWeekTime2DateTime​(double gpsWeekTime)
        Convert GPS Week Time to DateTime.
        Parameters:
        gpsWeekTime - the gps time.
        Returns:
        the DateTime of the gps time.
      • gpsWeekTime2WeekDay

        public static EGpsWeekDays gpsWeekTime2WeekDay​(double gpsWeekTime)
        Convert GPS Week Time to the day of the week.
        Parameters:
        gpsWeekTime - the gps time.
        Returns:
        the day of the week.
      • gpsWeekTime2ISO8601

        public static String gpsWeekTime2ISO8601​(double gpsWeekTime)
        Convert GPS Time to ISO8601 time string.
        Parameters:
        gpsWeekTime - the gps time.
        Returns:
        the ISO8601 string of the gps time.