casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Static Private Attributes
asdm::ArrayTime Class Reference

The ArrayTime class implements the concept of a point in time, implemented as an Interval of time since 17 November 1858 00:00:00 UTC, the beginning of the modified Julian Day. More...

#include <ArrayTime.h>

Inheritance diagram for asdm::ArrayTime:
asdm::Interval asdm::Interval

List of all members.

Public Member Functions

 ArrayTime ()
 The nullary constructor.
 ArrayTime (const string &s)
 Builds an ArrayTime out of the content of a string.
 ArrayTime (const ArrayTime &t)
 The copy constructor.
 ArrayTime (const IDLArrayTime &t)
 Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime.
 ArrayTime (int year, int month, double day)
 Builds an ArrayTime from a triple (year, month, day).
 ArrayTime (int year, int month, int day, int hour, int minute, double second)
 Build an ArrayTime from a sextuple (year, month, day, hour, minute, second.
 ArrayTime (double modifiedJulianDay)
 Build an ArrayTime from an MJD date.
 ArrayTime (int modifiedJulianDay, double secondsInADay)
 Build an ArrayTime from an MJD date.
 ArrayTime (int64_t nanoseconds)
 Build an ArrayTime from a number of nanoseconds.
double getJD () const
 Return the julian day.
double getMJD () const
 Return the modified julian day.
IDLArrayTime toIDLArrayTime () const
string toFITS () const
void toBin (EndianOSStream &eoss)
 Write the binary representation of this to a EndianOSStream.
int * getDateTime () const
double getTimeOfDay () const
int getDayOfWeek () const
int getDayOfYear () const
string timeOfDayToString () const
double getLocalSiderealTime (double longitudeInHours) const
double getGreenwichMeanSiderealTime () const
 ArrayTime ()
 The nullary constructor.
 ArrayTime (const string &s)
 Builds an ArrayTime out of the content of a string.
 ArrayTime (const ArrayTime &t)
 The copy constructor.
 ArrayTime (const IDLArrayTime &t)
 Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime.
 ArrayTime (int year, int month, double day)
 Builds an ArrayTime from a triple (year, month, day).
 ArrayTime (int year, int month, int day, int hour, int minute, double second)
 Build an ArrayTime from a sextuple (year, month, day, hour, minute, second.
 ArrayTime (double modifiedJulianDay)
 Build an ArrayTime from an MJD date.
 ArrayTime (int modifiedJulianDay, double secondsInADay)
 Build an ArrayTime from an MJD date.
 ArrayTime (int64_t nanoseconds)
 Build an ArrayTime from a number of nanoseconds.
double getJD () const
 Return the julian day.
double getMJD () const
 Return the modified julian day.
IDLArrayTime toIDLArrayTime () const
string toFITS () const
void toBin (EndianOSStream &eoss)
 Write the binary representation of this to a EndianOSStream.
int * getDateTime () const
double getTimeOfDay () const
int getDayOfWeek () const
int getDayOfYear () const
string timeOfDayToString () const
double getLocalSiderealTime (double longitudeInHours) const
double getGreenwichMeanSiderealTime () const

Static Public Member Functions

static bool isLeapYear (int year)
static double getMJD (double jd)
static double getJD (double mjd)
static ArrayTime add (const ArrayTime &time, const Interval &interval)
static ArrayTime sub (const ArrayTime &time, const Interval &interval)
static ArrayTime getArrayTime (StringTokenizer &t)
static void toBin (const vector< ArrayTime > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of ArrayTime to a EndianOSStream.
static void toBin (const vector< vector< ArrayTime > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream.
static void toBin (const vector< vector< vector< ArrayTime > > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream.
static ArrayTime fromBin (EndianIStream &eis)
 Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime.
static vector< ArrayTimefrom1DBin (EndianIStream &eis)
 Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime.
static vector< vector
< ArrayTime > > 
from2DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime.
static vector< vector< vector
< ArrayTime > > > 
from3DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime.
static double unitToJD (int64_t unit)
static double unitToMJD (int64_t unit)
static int64_t jdToUnit (double jd)
static int64_t mjdToUnit (double mjd)
static double utcCorrection (double jd)
static bool isLeapYear (int year)
static double getMJD (double jd)
static double getJD (double mjd)
static ArrayTime add (const ArrayTime &time, const Interval &interval)
static ArrayTime sub (const ArrayTime &time, const Interval &interval)
static ArrayTime getArrayTime (StringTokenizer &t)
static void toBin (const vector< ArrayTime > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of ArrayTime to a EndianOSStream.
static void toBin (const vector< vector< ArrayTime > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream.
static void toBin (const vector< vector< vector< ArrayTime > > > &arrayTime, EndianOSStream &eoss)
 Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream.
static ArrayTime fromBin (EndianIStream &eis)
 Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime.
static vector< ArrayTimefrom1DBin (EndianIStream &eis)
 Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime.
static vector< vector
< ArrayTime > > 
from2DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime.
static vector< vector< vector
< ArrayTime > > > 
from3DBin (EndianIStream &eis)
 Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime.
static double unitToJD (int64_t unit)
static double unitToMJD (int64_t unit)
static int64_t jdToUnit (double jd)
static int64_t mjdToUnit (double mjd)
static double utcCorrection (double jd)

Static Public Attributes

static const int numberSigDigitsInASecond
 Useful constants.
static const int64_t unitsInASecond
static const int64_t unitsInADayL
static const double unitsInADay
static const double unitsInADayDiv100
static const double julianDayOfBase
static const int64_t julianDayOfBaseInUnitsInADayDiv100

Private Member Functions

int64_t FITSString (string t) const
int64_t FITSString (string t) const

Static Private Member Functions

static int64_t init (int year, int month, double day)
static int64_t init (int year, int month, int day, int hour, int minute, double second)
static int64_t init (int year, int month, double day)
static int64_t init (int year, int month, int day, int hour, int minute, double second)

Static Private Attributes

static const UTCCorrectionUTCCorrectionTable
static const UTCCorrection UTCLast

Detailed Description

The ArrayTime class implements the concept of a point in time, implemented as an Interval of time since 17 November 1858 00:00:00 UTC, the beginning of the modified Julian Day.

All dates are assumed to be in the Gregorian calendar, including those prior to October 15, 1582. So, if you are interested in very old dates, this isn't the most convenient class to use.

Internally the time is kept in units of nanoseconds (10-9 seconds). The base time is 17 November 1858 00:00:00 UTC, and the maximum time is to the year 2151 (2151-02-25T23:47:16.854775807). This differs from the OMG Time service The OMG time is in units of 100 nanoseconds using the beginning of the Gregorian calandar,15 October 1582 00:00:00 UTC, as the base time. The reason for this increased accuracy is that the Control system is capable of measuring time to an accuracy of 40 nanoseconds. Therefore, by adhering to the representation of time used in the OMG Time Serivce we would be losing precision.

The Time class is an extension of the Interval class, since all times are intervals since 17 November 1858 00:00:00 UTC.

All times in this class are assumed to be International Atomic Time (TAI). A specific TAI time differs from the corresponding UTC time by an offset that is an integral number of seconds.

In the methods that give various quantities associated with calendar times, this class does not apply any UTC corrections. Therefore, if you use these methods to produce calendar times, the results will differ from civil time by a few seconds. The classes UTCTime and LocalTime take the UTC and timezone corrections into account.

The main reference used in crafting these methods is Astronomical Algorithms by Jean Meeus, second edition, 2000, Willmann-Bell, Inc., ISBN 0-943396-61-1. See chapter 7, "Julian day", and chapter 12, "Sidereal Time".

Version:
1.0 12 January, 2004
Author:
Allen Farris
Version:
1.1 Aug 8, 2006
Author:
Michel Caillat added toBin/fromBin methods.

Definition at line 94 of file ArrayTime.h.


Constructor & Destructor Documentation

The nullary constructor.

Builds an ArrayTime corresponding to the origin of time i. e. 17 November 1858 00:00:00 UTC

asdm::ArrayTime::ArrayTime ( const string &  s)

Builds an ArrayTime out of the content of a string.

If the string contains the textual representation of a double precision value then it will be considered as an MJD date. If the strign contains the textual representation of an integer value then it will be considered as an interval of time counted in nanoseconds since the 17 November 1858 00:00:00 UTC.

Parameters:
sa const reference to a string.

The copy constructor.

Parameters:
sa const reference to an ArrayTime.
asdm::ArrayTime::ArrayTime ( const IDLArrayTime &  t)

Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime.

Parameters:
ta const reference to an IDLArrayTime.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
double  day 
)

Builds an ArrayTime from a triple (year, month, day).

Parameters:
yeara positive integer value,
monthan integer in the range [1, 12],
daya value in double precision, whose integer value must be in a valid range depending on the month.
Exceptions:
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
)

Build an ArrayTime from a sextuple (year, month, day, hour, minute, second.

Parameters:
yeara positive integer value,
monthan integer in the range [1, 12],
dayan integer in the usual range depending on the month,
houran integer in the range [0, 23],
minutean integer value in the range [0, 59],
seconda value in double precision whose integer part must be in the range [0, 59].
Exceptions:
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( double  modifiedJulianDay)

Build an ArrayTime from an MJD date.

Parameters:
modifieJulianDaya value in double precision.
asdm::ArrayTime::ArrayTime ( int  modifiedJulianDay,
double  secondsInADay 
)

Build an ArrayTime from an MJD date.

Parameters:
modifiedJulianDayan integer value to express the integer part of the MJD date,
secondsInADaya value in double precision to express the decimal part of the MJD date.
asdm::ArrayTime::ArrayTime ( int64_t  nanoseconds)

Build an ArrayTime from a number of nanoseconds.

Parameters:
nanosecondsa int64_t integer value to express a number of nanoseconds since 17 November 1858 00:00:00 UTC.

The nullary constructor.

Builds an ArrayTime corresponding to the origin of time i. e. 17 November 1858 00:00:00 UTC

asdm::ArrayTime::ArrayTime ( const string &  s)

Builds an ArrayTime out of the content of a string.

If the string contains the textual representation of a double precision value then it will be considered as an MJD date. If the strign contains the textual representation of an integer value then it will be considered as an interval of time counted in nanoseconds since the 17 November 1858 00:00:00 UTC.

Parameters:
sa const reference to a string.

The copy constructor.

Parameters:
sa const reference to an ArrayTime.
asdm::ArrayTime::ArrayTime ( const IDLArrayTime &  t)

Builds an ArrayTime from the CORBA/IDL representation of an ArrayTime.

Parameters:
ta const reference to an IDLArrayTime.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
double  day 
)

Builds an ArrayTime from a triple (year, month, day).

Parameters:
yeara positive integer value,
monthan integer in the range [1, 12],
daya value in double precision, whose integer value must be in a valid range depending on the month.
Exceptions:
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
)

Build an ArrayTime from a sextuple (year, month, day, hour, minute, second.

Parameters:
yeara positive integer value,
monthan integer in the range [1, 12],
dayan integer in the usual range depending on the month,
houran integer in the range [0, 23],
minutean integer value in the range [0, 59],
seconda value in double precision whose integer part must be in the range [0, 59].
Exceptions:
InvalidArgumentException.
asdm::ArrayTime::ArrayTime ( double  modifiedJulianDay)

Build an ArrayTime from an MJD date.

Parameters:
modifieJulianDaya value in double precision.
asdm::ArrayTime::ArrayTime ( int  modifiedJulianDay,
double  secondsInADay 
)

Build an ArrayTime from an MJD date.

Parameters:
modifiedJulianDayan integer value to express the integer part of the MJD date,
secondsInADaya value in double precision to express the decimal part of the MJD date.
asdm::ArrayTime::ArrayTime ( int64_t  nanoseconds)

Build an ArrayTime from a number of nanoseconds.

Parameters:
nanosecondsa int64_t integer value to express a number of nanoseconds since 17 November 1858 00:00:00 UTC.

Member Function Documentation

static ArrayTime asdm::ArrayTime::add ( const ArrayTime time,
const Interval interval 
) [static]
static ArrayTime asdm::ArrayTime::add ( const ArrayTime time,
const Interval interval 
) [static]
int64_t asdm::ArrayTime::FITSString ( string  t) const [private]
int64_t asdm::ArrayTime::FITSString ( string  t) const [private]
static vector<ArrayTime> asdm::ArrayTime::from1DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime.

Parameters:
disthe EndianIStream to be read
Returns:
a vector of ArrayTime

Reimplemented from asdm::Interval.

static vector<ArrayTime> asdm::ArrayTime::from1DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of ArrayTime from an EndianIStream and use the read value to set a vector of ArrayTime.

Parameters:
disthe EndianIStream to be read
Returns:
a vector of ArrayTime

Reimplemented from asdm::Interval.

static vector<vector<ArrayTime> > asdm::ArrayTime::from2DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime.

Parameters:
eiisthe EndianIStream to be read
Returns:
a vector of vector of ArrayTime

Reimplemented from asdm::Interval.

static vector<vector<ArrayTime> > asdm::ArrayTime::from2DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of ArrayTime.

Parameters:
eiisthe EndianIStream to be read
Returns:
a vector of vector of ArrayTime

Reimplemented from asdm::Interval.

static vector<vector<vector<ArrayTime> > > asdm::ArrayTime::from3DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime.

Parameters:
eisthe EndianIStream to be read
Returns:
a vector of vector of vector of ArrayTime
static vector<vector<vector<ArrayTime> > > asdm::ArrayTime::from3DBin ( EndianIStream eis) [static]

Read the binary representation of a vector of vector of vector of ArrayTime from an EndianIStream and use the read value to set a vector of vector of vector of ArrayTime.

Parameters:
eisthe EndianIStream to be read
Returns:
a vector of vector of vector of ArrayTime
static ArrayTime asdm::ArrayTime::fromBin ( EndianIStream eis) [static]

Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime.

Parameters:
eisthe EndianStream to be read
Returns:
an ArrayTime

Reimplemented from asdm::Interval.

static ArrayTime asdm::ArrayTime::fromBin ( EndianIStream eis) [static]

Read the binary representation of an ArrayTime from a EndianIStream and use the read value to set an ArrayTime.

Parameters:
eisthe EndianStream to be read
Returns:
an ArrayTime

Reimplemented from asdm::Interval.

static double asdm::ArrayTime::getJD ( double  mjd) [static]
static double asdm::ArrayTime::getJD ( double  mjd) [static]
double asdm::ArrayTime::getJD ( ) const

Return the julian day.

Returns:
a value in double precision expressing this in julian day.
double asdm::ArrayTime::getJD ( ) const

Return the julian day.

Returns:
a value in double precision expressing this in julian day.
double asdm::ArrayTime::getLocalSiderealTime ( double  longitudeInHours) const
double asdm::ArrayTime::getLocalSiderealTime ( double  longitudeInHours) const
static double asdm::ArrayTime::getMJD ( double  jd) [static]
static double asdm::ArrayTime::getMJD ( double  jd) [static]
double asdm::ArrayTime::getMJD ( ) const

Return the modified julian day.

Returns:
a value in double precision expressing this in modified julian day.
double asdm::ArrayTime::getMJD ( ) const

Return the modified julian day.

Returns:
a value in double precision expressing this in modified julian day.
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
double  day 
) [static, private]
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
double  day 
) [static, private]
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
) [static, private]
static int64_t asdm::ArrayTime::init ( int  year,
int  month,
int  day,
int  hour,
int  minute,
double  second 
) [static, private]
static bool asdm::ArrayTime::isLeapYear ( int  year) [static]
static bool asdm::ArrayTime::isLeapYear ( int  year) [static]
static int64_t asdm::ArrayTime::jdToUnit ( double  jd) [static]
static int64_t asdm::ArrayTime::jdToUnit ( double  jd) [static]
static int64_t asdm::ArrayTime::mjdToUnit ( double  mjd) [static]
static int64_t asdm::ArrayTime::mjdToUnit ( double  mjd) [static]
static ArrayTime asdm::ArrayTime::sub ( const ArrayTime time,
const Interval interval 
) [static]
static ArrayTime asdm::ArrayTime::sub ( const ArrayTime time,
const Interval interval 
) [static]

Write the binary representation of this to a EndianOSStream.

Reimplemented from asdm::Interval.

Write the binary representation of this to a EndianOSStream.

Reimplemented from asdm::Interval.

static void asdm::ArrayTime::toBin ( const vector< ArrayTime > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const vector< ArrayTime > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const vector< vector< ArrayTime > > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const vector< vector< ArrayTime > > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const vector< vector< vector< ArrayTime > > > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
static void asdm::ArrayTime::toBin ( const vector< vector< vector< ArrayTime > > > &  arrayTime,
EndianOSStream eoss 
) [static]

Write the binary representation of a vector of vector of vector of ArrayTime to a EndianOSStream.

Parameters:
arrayTimethe vector of vector of vector of ArrayTime to be written
eossthe EndianOSStream to be written to
string asdm::ArrayTime::toFITS ( ) const
string asdm::ArrayTime::toFITS ( ) const
IDLArrayTime asdm::ArrayTime::toIDLArrayTime ( ) const
IDLArrayTime asdm::ArrayTime::toIDLArrayTime ( ) const
static double asdm::ArrayTime::unitToJD ( int64_t  unit) [static]
static double asdm::ArrayTime::unitToJD ( int64_t  unit) [static]
static double asdm::ArrayTime::unitToMJD ( int64_t  unit) [static]
static double asdm::ArrayTime::unitToMJD ( int64_t  unit) [static]
static double asdm::ArrayTime::utcCorrection ( double  jd) [static]
static double asdm::ArrayTime::utcCorrection ( double  jd) [static]

Member Data Documentation

static const double asdm::ArrayTime::julianDayOfBase [static]

Definition at line 104 of file ArrayTime.h.

Definition at line 105 of file ArrayTime.h.

static const int asdm::ArrayTime::numberSigDigitsInASecond [static]

Useful constants.

Definition at line 99 of file ArrayTime.h.

static const double asdm::ArrayTime::unitsInADay [static]
static const double asdm::ArrayTime::unitsInADayDiv100 [static]

Definition at line 103 of file ArrayTime.h.

static const int64_t asdm::ArrayTime::unitsInADayL [static]

Definition at line 101 of file ArrayTime.h.

static const int64_t asdm::ArrayTime::unitsInASecond [static]

Definition at line 100 of file ArrayTime.h.

static const UTCCorrection * asdm::ArrayTime::UTCCorrectionTable [static, private]

Definition at line 312 of file ArrayTime.h.

static const UTCCorrection asdm::ArrayTime::UTCLast [static, private]

Definition at line 313 of file ArrayTime.h.


The documentation for this class was generated from the following files: