Chapter 9. Time and astronomical measurements

Table of Contents

9.1. Time Definitions
9.1.1. System time in HIPE
9.1.2. International Atomic Time (TAI) and FineTime
9.1.3. Coordinated Universal Time (UTC)
9.1.4. DecMec Time [PACS only]
9.2. Time in Instrument House-Keeping (HK) Data
9.3. Time conversion
9.3.1. Time conversion in HIPE
9.3.2. CucConverter
9.4. Great circle and position angle calculations

The first part of this chapter describes how time is defined within HCSS and how to deal with it. Unfortunately, there are several ways in which time can be represented. The standard for the HCSS/DP is a FineTime - which is the number of microseconds since the beginning of 1 January 1958. This provides the kind of accuracy needed to represent time on a space mission.

However, there are several other time representations and it is often the case that conversions between times/dates is necessary. In particular, it is noted that the standard Java commands lead to date measurements with respect to 1 January 1970. This chapter indicates how to deal with times within DP and converting between the various times, particularly between dates and FineTime's.

The last section of this chapter explains how to carry out great circle and position angle calculations.

9.1. Time Definitions

9.1.1. System time in HIPE

There are many ways to access the system time in HIPE. See also the description of the Java class "Date" for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).

The Java Date class is deprecated and is being replaced by a more flexible SimpleDateFormat capability within Java that allows the user to express dates more conveniently. A Date object is still obtained and can be turned into a FineTime (see below) once created.

Two possibilities for creating a "Date" object are:

# To get the current time in milliseconds: 
# The difference, measured in milliseconds, between the current 
# time and midnight, January 1, 1970 UTC. 
print java.lang.System.currentTimeMillis() 
# To get the number of milliseconds since 
# January 1, 1970, 00:00:00 GMT represented by a Date object. 
d = java.util.Date() 
#printing this gives the current time and date at the location of the 
#system on which the java is being run.
print d
#We can also get the number of milliseconds since Jan 1, 1970 using
#this Java Date
print d.getTime()

Example 9.1. How to obtain the current time by various methods.


Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger.

If we want to get the number of milliseconds since 1 January 1970 for any other date then we can use a non-default form of the Java Date capability where the year, month, day, hour, minute and second are provided.

  • Year format -- year (A.D.) - 1900. So the year 2006 = 2006 - 1900 = 106

  • Month format -- number of the month, beginning from January = 0. E.g. March = 2.

  • Day -- just day number in the month.

  • Hours, minutes, seconds -- on the 24-hour clock.

NOTE: This is the time on our computer system.

#Format of date is year (in units of true year - 1900), month (number 0...11), 
#day, hour, minute, second. So the following gives us the number of milliseconds 
#between the beginning of 1 January 1970 and 3:15:00 pm on 23 October 2004.
d = java.util.Date(104, 9, 23, 15, 15, 0)
print d # should indeed show we have 3:15pm on 23 October 2004
print d.getTime() # provides the number of milliseconds between this 
#date and 1 Jan 1970.

Example 9.2. Different ways of formatting time variables.


The following sample code shows how to use SimpleDateFormat to create a "Date" object.

simpleDate = java.text.SimpleDateFormat("yyyy.MM.dd HH:mm:ss z")
#set up how you want to set up your input Date format. In this
#case we could input "2006.01.14 01:00:00 CST" for 1a.m. on 14
#January 2006. z -- indicates the time zone (default is the zone for the
#computer system being used).

simpleDate.applyPattern("dd/MM/yy HH:mm")
#change the pattern to a different format

startTime = simpleDate.parse("13/01/06 14:06")
#create the data object "startTime"

print startTime
#...and see what this looks like

Example 9.3. Creating a date object.


Allowed choices for the data format are available from Java documentation of the SimpleDateFormat capability.

9.1.2. International Atomic Time (TAI) and FineTime

TAI is an international standard measurement of time based on the comparison of many atomic clocks. TAI is the basis for Coordinated Universal Time (UTC). Finetime is based on TAI as measured from 00:00:00 1 January 1958.

9.1.3. Coordinated Universal Time (UTC)

UTC, World Time, is the standard time common to every place in the world. UTC is derived from International Atomic Time (TAI) by the addition of a whole number of "leap seconds" to synchronise it with Universal Time 1 (UT1), thus allowing for the eccentricity of the Earth's orbit and the rotational axis tilt (23.5 degrees), but still showing the Earth's irregular rotation, on which UT1 is based.

9.1.4. DecMec Time [PACS only]

The commands DPUSelectTime and DPUWriteTime are selecting and setting a start time which is written to the TMP1 and TMP2 fields of the Dec/Mec headers. This is used in coordinating the activities of the mechanical devices on board PACS. It is possible to construct an absolute time by adding counters (CRDC) to the start time considering an offset between setting and writing the start time.

This offset is expected to be a number with an uncertainty depending on the system load. It might require a calibration file. Currently this offset is not considered.

In case the commands and are not given the TMP1 and TMP2 fields are zero. To avoid software confusions the time will be related to a fixed date (1.Jan 1970, 0:00).

During construction of the SpuBuffer the time is computed from the TMP1, TMP2 entries in the Dec/Mec header and the CRDC counter. This time is used during construction of the DataFrameSequence and the associated Tables holding the SPU science data.

Between the Dec/Mec time and the packet time (see the PusTmBinStruct class in the herschel.binstruct package) we have an offset. Therefore the association between HK and science data will be within an accuracy of 2 seconds.