View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Andrew Main (Zefram) > Time-GPS-0.003 > Time::GPS



Annotate this POD

View/Report Bugs
Module Version: 0.003   Source  


Time::GPS - Global Positioning System time


        use Time::GPS qw(gps_instant_to_mjd gps_mjd_to_instant);

        $mjd = gps_instant_to_mjd($instant);
        $instant = gps_mjd_to_instant($mjd);

        use Time::GPS qw(gps_realisation);

        $rln = gps_realisation("");
        $instant = $rln->to_tai($gps_instant);


The Global Positioning System (GPS) includes as an integral feature the dissemination of a very precise time scale. This time scale is produced by atomic clocks on the satellites, and is steered to keep in step with International Atomic Time (TAI). The GPS time scale is thus indirectly a realisation of Terrestrial Time (TT). GPS time is one of the most accurate and the most accessible realisations of TAI.

This module represents instants on the TAI time scale as a scalar number of TAI seconds since an epoch. This is an appropriate form for all manner of calculations. The epoch used is that of TAI, at UT2 instant 1958-01-01T00:00:00.0 as calculated by the United States Naval Observatory, even though GPS did not exist then. This matches the convention used by Time::TAI for instants on the TAI scale and by Time::TT for instants on the TT scale.

There is also a conventional way to represent GPS time instants using day-based notations associated with planetary rotation `time' scales. The `day' of GPS is a nominal period of exactly 86400 GPS seconds, which is slightly shorter than an actual Terran day. The start of the GPS time scale, at UTC instant 1980-01-06T00:00:00.0 (TAI instant 1980-01-06T00:00:19.0) is assigned the label 1980-01-06T00:00:00.0 (MJD 44244.0). Because GPS time is not connected to Terran rotation, and so has no inherent concept of a day, it is somewhat misleading to use such day-based notations. Conversion between this notation and the linear count of seconds is supported by this module. This notation does not match the similar day-based notations used for TAI and TT.



Converts from a count of seconds to a Modified Julian Date in the manner conventional for GPS time. The MJD can be further converted to other forms of day-based date using other modules. The input must be a Math::BigRat object, and the result is the same type.


Converts from a Modified Julian Date, interpreted in the manner conventional for GPS time, to a count of seconds. The input must be a Math::BigRat object, and the result is the same type.


Looks up and returns an object representing a named realisation of GPS time. The object returned is of the class Time::TT::Realisation; see the documentation of that class for its interface.

Presently the only name recognised is the empty string, representing GPS time itself. Other names may be recognised in the future.

The Time::TAI module is required in order to do this.


Date::JD, Time::TAI, Time::TT, Time::TT::Realisation


Andrew Main (Zefram) <>


Copyright (C) 2006, 2009, 2010, 2012 Andrew Main (Zefram) <>


This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: