# «Standards Of Fundamental Astronomy SOFA Time Scale and Calendar Tools Software version 13 Document revision 1.4 Version for C programming language ...»

International Astronomical Union

Standards Of Fundamental Astronomy

SOFA Time Scale and Calendar Tools

Software version 13

Document revision 1.4

Version for C programming language

http://www.iausofa.org

2016 July 14

## SOFA BOARD MEMBERS

John Bangert United States Naval Observatory (retired)

Steven Bell Her Majesty’s Nautical Almanac Oﬃce

Mark Calabretta Australia Telescope National Facility (retired) Nicole Capitaine Paris Observatory William Folkner Jet Propulsion Laboratory Catherine Hohenkerk Her Majesty’s Nautical Almanac Oﬃce (chair) Li Jinling Shanghai Astronomical Observatory Brian Luzum United States Naval Observatory (IERS) Zinovy Malkin Pulkovo Observatory, St Petersburg Jeﬀrey Percival University of Wisconsin Scott Ransom National Radio Astronomy Observatory Patrick Wallace RAL Space (retired) ⃝ Copyright 2010-16 International Astronomical Union. All c Rights Reserved. Reproduction, adaptation, or translation without prior written permission is prohibited, except as al- lowed under the copyright laws.

CONTENTS iii Contents 1 Preliminaries 1

1.1 Introduction....................................... 1

1.2 Quick start....................................... 1

1.3 The SOFA time and date routines.......................... 1

1.4 Intended audience................................... 2

1.5 A simple example: UTC to TT............................ 2

1.6 Abbreviations...................................... 3 2 Times and dates 4

2.1 Timekeeping basics................................... 4

2.2 Formatting con

1 Preliminaries

1.1 Introduction SOFA stands for Standards Of Fundamental Astronomy. The SOFA software is a collection of Fortran 77 and C subprograms that implement oﬃcial IAU algorithms for fundamentalastronomy computations. At the present time the SOFA software comprises 164 astronomy routines supported by 55 utility (mainly vector/matrix) routines. The core documentation for the SOFA collection consists of classiﬁed and alphabetic lists of subroutine calls plus detailed preamble comments in the source code of individual routines.

The present document looks at a selection of SOFA routines that deal with dates and times. It provides a tutorial introduction to timekeeping and the main time scales and calendars used by astronomers. Short examples demonstrate how to call SOFA routines to perform the sorts of conversions and transformations that may be needed in applications where times and dates are involved.

**1.2 Quick start**

Readers already familiar with the elementary concepts can safely omit the explanatory material and refer directly to the examples in Sections 1.5 and 4.4, and others that can be found embedded in the text. Figure 2 shows the supported time scales and the names of the transformation routines.

1.3 The SOFA time and date routines

**The SOFA routines to be discussed are the following:**

1.4 Intended audience The SOFA time routines are designed for convenient practical use, with levels of rigor that are consistent with this goal. Inevitably, many ﬁne details are glossed over, such as transforming topocentric proper time to TAI, diﬀerent realizations of TT, competing TDB−TT models, and so on. Furthermore, the “proleptic” issue is largely ignored; for instance the routines will blithely perform a transformation from TAI to TT for a date in the nineteenth century, long before either time scale was introduced. These simpliﬁcations notwithstanding, time specialists may nevertheless ﬁnd SOFA useful as a reliable source of comparison results.

1.5 A simple example: UTC to TT A particularly common application is when a moment in one time scale is to be referred to

**another time scale. This requires three steps:**

1. Call the DTF2D routine to transform the date and time into the SOFA internal format.

2. Call the appropriate sequence of transformation routines (see Figure 2).

3. Call the D2DTF routine to prepare the transformed time for output.

For example, to transform 2010 July 24, 11:18:07.318 (UTC) into terrestrial time TT, and report

**it, rounded to 1 ms precision:**

2.1 Timekeeping basics Timekeeping means following an agreed recipe for measuring time, using some natural “clock” as a basis. The most practical phenomena for this purpose are rotations and oscillations, and for most of history the Earth’s rotation was the best available timekeeper. Because time was synonymous with the cycle of day and night, the units used to express time intervals reﬂect that choice: days, divided into hours, minutes and seconds. For larger intervals, other astronomical phenomena play a role, in particular the orbital periods of the Earth and Moon.

Repeated attempts in the 19th century to model the motion of solar system objects, especially the fast-moving Moon, were only partially successful. Each new theory, while reproducing existing data accurately, would soon start to diverge from observation. The pragmatic solution was to create a tautology by regarding the theories as clocks in their own right; in eﬀect the clock’s hands were the bodies of the solar system, reading out “ephemeris time”. However, once man-made clocks became suﬃciently accurate, suspicions that irregularities in Earth rotation had all along been the limiting factor were conﬁrmed, and laboratory time scales created by such clocks—nowadays atomic, before that quartz—took over as the primary timekeeping standard.

2.2 Formatting conventions A consequence of the history of timekeeping (and, in the case of the calendar, the nature of the problem) is that the rules for expressing and transforming times and dates are somewhat complicated and inconvenient.

**The output (i.e. test time, equivalent fraction of a day, time six hours earlier) is:**

23:05:11.630799 0.961940171285 17:05:11.631 The familiar Gregorian calendar date, consisting of year, month and day, is designed to keep more or less in step with the tropical year, the year of the seasons, which has a length of about

365.2422 days. Its predecessor, the Julian calendar, approximated the tropical year by using a basic 365-day year and introducing an extra day (February 29) in every fourth year, giving an average year length of 365.25 days. Astronomers still use the latter, the terms Julian year and Julian century meaning exactly 365.25 and 36525 days respectively. The Gregorian calendar provided a better approximation to the tropical year by dropping three such leap years in each 400 years, to give an average of 365.2425 days. The rule is that century years must be divisible by 400 to be a leap year; other years are leap years if they are divisible by 4. So the year 2000 was a leap year, but 2100 will not be a leap year.

**2.3 Julian date**

For many purposes, calendar date is inconvenient: what is needed is a continuous count of days. For this purpose the system of Julian day number can be used. JD zero is located about 7000 years ago, well before the historical era, and is formally deﬁned in terms of Greenwich noon;1 for example Julian day number 2449444 began at noon on 1994 April 1.

Julian date (JD) is the same system but with a fractional part appended; JD 2449443.5 was the midnight on which 1994 April 1 commenced. Because of the unwieldy size of Julian Dates and the awkwardness of the half-day oﬀset, it is accepted practice to remove the leading ‘24’ and the

**trailing ‘.5’, producing what is called the Modiﬁed Julian Date:**

Thus 1994 April 1 commenced at MJD 49443.0.

MJD is often used in computer applications, rather than JD itself, to reduce exposure to rounding errors. SOFA goes one step further, by always expressing JD as two double precision numbers, the sum of which is the desired JD. The user decides how best to apportion the JD. In applications where precision is not critical, one of the two parts can simply be set to zero and the other to the JD itself. A better compromise might be 2400000.5 as one of the numbers, and the MJD as the other. The various SOFA routines go to some trouble to use the two parts wisely—they are not simply added together—and the preamble comments in the various routines indicate which split will give optimal accuracy.

The SOFA routine CAL2JD expresses a given Gregorian calendar date as a two-part JD. The routine JD2CAL takes a two-part JD and breaks it into Gregorian calendar date plus a fraction of a day. The routine JDCALF does a similar job, but rounds to a speciﬁed precision and returns the fraction as an integer, ready for use in a message or report. Here is a demonstration, using

**a deliberately awkward date and time close to the end of a month:**

The output (i.e. date and time, MJD and JD equivalents, date with fractional day, the same

**but rounded) is:**

2008/02/29 23:59:59.9 2400000.5 + 54525.999999 = 2454526.499999 2008/02/29.999999 2008/03/01.000

2.4 Besselian and Julian epochs For some astronomical purposes it is convenient to work in fractional years, such that a given date and time near the end of 2009 (for example) can be written “2009.93”.

Formerly, this was done using a system called Besselian epoch. The unit is tropical years (about

365.2422 days), the time scale is ephemeris time (Section 3.2) and the Besselian year begins when the ecliptic longitude of the mean Sun is 280◦ —which occurs near the start of the calendar year and which is why that particular round ﬁgure was chosen. Besselian epochs are mainly associated with older star catalogues, specifying the mean equator and equinox and hence the celestial orientation of the equatorial coordinate system used by the catalogue concerned.

Julian epoch took over from the beginning of 1984. It uses the Julian year of exactly 365.25 days, and the TT time scale (Section 3.2); Julian epoch 2000 is deﬁned to be 2000 January 1.5, which is JD 2451545.0 or MJD 51544.5.

The two types of epoch are denoted by a preﬁx ‘B’ or ‘J’, hence “B1950.0” and “J2000.0”. In the absence of such a preﬁx, it can be assumed that epochs before 1984.0 are Besselian and, from

1984.0 on, Julian. The transformations between MJD and the two types of epoch are carried out by the SOFA routines EPB, EPB2JD, EPJ and EPJ2JD. They are demonstrated in the

**following code:**

Calculations in any scientiﬁc discipline may involve precise time, but what sets astronomy apart is the number and variety of time scales that have to be used. There are several reasons for this: astronomers must continue to deal with the very phenomena that lie behind obsolete time scales, in particular the rotation of the Earth and the motions of the planets; as new time scales have been introduced, continuity with the past has been preserved, leaving in the various astronomical time scales a fossil record of former oﬀsets and rates; and in astronomical applications the physical context of the “clock” matters, whether it is on Earth, moving or stationary, or on a spacecraft.

3.2 SOFA support for time scales

**SOFA provides routines to handle the following seven time scales, all important to astronomers:**

• TAI (International Atomic Time): the oﬃcial timekeeping standard.

• UTC (Coordinated Universal Time): the basis of civil time.

• UT1 (Universal Time): based on Earth rotation.

• TT (Terrestrial Time): used for solar system ephemeris look-up.2

• TCG (Geocentric Coordinate Time): used for calculations centered on the Earth in space.

• TCB (Barycentric Coordinate Time): used for calculations beyond Earth orbit.

**Note that the above list does not include:**

• UT0, UT2: specialist forms of universal time that take into account polar motion and known seasonal eﬀects; no longer used.

• Sidereal time—which is an angle rather than a time.3

• TDT (terrestrial dynamical time): the former name of TT.

• Civil time (BST, PDT etc.): these are UTC oﬀset by some number of hours (or half hours, or even quarter hours, in some cases), depending on longitude and time of year.

• Solar (sundial) time.

• GPS time: strictly speaking not itself an oﬃcially recognized time scale, but an accurate and inexpensive way of bringing precise time into an observatory (see Section 3.4).

Of the seven time scales to be described here, one is atomic time (TAI), one is solar time (UT1), one is an atomic/solar hybrid (UTC) and four are dynamical times (TT, TCG, TCB, TDB). Each has a distinct role, and there are oﬀsets of tens of seconds between some of them: when planning an astronomical calculation it is vital to choose the right one. A particularly common mistake is to assume that there is just one sort of precise time, namely UTC, compatible with everything from telescope pointing (which actually requires UT1) to looking up planetary positions (which requires TDB, which may be approximated by TT). In fact UTC itself is almost never the time scale to use for astronomical calculations, except perhaps for record-keeping.

Figure 1 is a “route map” showing how the seven SOFA-supported time scales are related, and how a time on one scale can be transformed into the same time on another scale. The time scales are represented by the rectangular boxes, and their relationships are shown in the rounded boxes. n.b. Both the diagram and the text gloss over many ﬁne details, in order to concentrate on practical applications.