CppEphem
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CETime Class Reference

This class stores and computes information regarding the time and handles conversions to current time zone. This method is mostly intended to serve as a helper class to CEDate.

Definition at line 37 of file CETime.h.

Public Member Functions

 CETime ()
 Default constructor. More...
 
 CETime (const CETime &other)
 Copy constructor. More...
 
 CETime (const double &time, CETimeType time_format=CETimeType::UTC)
 Primary constructor. More...
 
 CETime (std::vector< double > time, CETimeType time_format=CETimeType::UTC)
 Used for setting the time from a vector where: More...
 
double Hour (void) const
 Return the Hour associated with this time object. More...
 
double Min (void) const
 Return the Minute associated with this time object. More...
 
CETimeoperator= (const CETime &other)
 Copy assignment operator. More...
 
double Sec (void) const
 Return the Second associated with this time object. More...
 
void SetHours (const double &hours)
 
void SetMinutes (const double &minutes)
 
void SetSeconds (const double &seconds)
 
void SetTime (const double &time, CETimeType time_format=CETimeType::UTC)
 Set time from double of the form HHMMSS.SS and a specified time format. More...
 
void SetTime (std::vector< double > time_vect, CETimeType time_format=CETimeType::UTC)
 Set the time from a vector and a user specified format. More...
 
virtual ~CETime ()
 Destructor. More...
 

Static Public Member Functions

static double CurrentUTC ()
 Get the current UTC time as seconds since midnight. More...
 
static std::vector< double > CurrentUTC_vect ()
 Get the current UTC time as a vector. More...
 
static double SystemUTCOffset_hrs ()
 
static std::vector< double > TimeDbl2Vect (const double &time)
 Convert a time formatted as HHMMSS.SS into a vector. More...
 
static double TimeSec2Time (const double &seconds)
 Convert number of seconds since midnight to HHMMSS.S formatted double. More...
 
static std::vector< double > TimeSec2Vect (const double &seconds)
 Convert number of seconds since midnight to HHMMSS.S formatted double. More...
 
static double TimeVect2Dbl (std::vector< double > time)
 Convert a time formatted as HHMMSS.SS into a vector. More...
 
static double UTC (const double &jd)
 Get the current UTC time. More...
 
static void UTC2GAST ()
 
static void UTC2LAST ()
 
static void UTC2LOCALTIME ()
 
static std::vector< double > UTC_vect (const double &jd)
 Get the UTC time of a given julian date as a vector. More...
 

Private Member Functions

void copy_members (const CETime &other)
 Copy data members from another object of the same type. More...
 
void free_members (void)
 Deallocate data members if necessary. More...
 
void init_members (void)
 Initialize data members. More...
 
void SetTime_GAST (std::vector< double > time)
 Set the time from a vector representing Greenwich Apparent Sidereal Time. More...
 
void SetTime_LOCALTIME (std::vector< double > time)
 Set the time from a vector representing local observer time. More...
 
void SetTime_LST (std::vector< double > time)
 Set the time from a vector representing Local Sidereal Time. More...
 
void SetTime_UTC (std::vector< double > time)
 Set the time from a vector representing UTC time. More...
 

Private Attributes

std::vector< double > time_
 
CETimeType time_type_
 

#include <CETime.h>

Constructor & Destructor Documentation

◆ CETime() [1/4]

CETime::CETime ( )

Default constructor.

Definition at line 38 of file CETime.cpp.

◆ CETime() [2/4]

CETime::CETime ( const double &  time,
CETimeType  time_format = CETimeType::UTC 
)

Primary constructor.

Parameters
timeTime from a HHMMSS.S formatted double
time_formatSpecifies what type is represented by 'time' (see CETimeType)

Definition at line 49 of file CETime.cpp.

◆ CETime() [3/4]

CETime::CETime ( std::vector< double >  time,
CETimeType  time_format = CETimeType::UTC 
)

Used for setting the time from a vector where:

Parameters
timevector specifying the time
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second
time_formatSpecifies what type is represented by 'time' (see CETimeType)

Definition at line 67 of file CETime.cpp.

◆ CETime() [4/4]

CETime::CETime ( const CETime other)

Copy constructor.

Parameters
other

Definition at line 86 of file CETime.cpp.

◆ ~CETime()

CETime::~CETime ( )
virtual

Destructor.

Definition at line 96 of file CETime.cpp.

Member Function Documentation

◆ copy_members()

void CETime::copy_members ( const CETime other)
private

Copy data members from another object of the same type.

Parameters
[in]otherCETime object to copy from

Definition at line 340 of file CETime.cpp.

◆ CurrentUTC()

double CETime::CurrentUTC ( )
static

Get the current UTC time as seconds since midnight.

Returns
Seconds since midnight

Definition at line 124 of file CETime.cpp.

◆ CurrentUTC_vect()

std::vector< double > CETime::CurrentUTC_vect ( )
static

Get the current UTC time as a vector.

Returns
Vector containing the various time components
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second

Definition at line 157 of file CETime.cpp.

◆ free_members()

void CETime::free_members ( void  )
private

Deallocate data members if necessary.

Definition at line 361 of file CETime.cpp.

◆ Hour()

double CETime::Hour ( void  ) const
inline

Return the Hour associated with this time object.

Returns
Hour associated with this time object

Definition at line 141 of file CETime.h.

◆ init_members()

void CETime::init_members ( void  )
private

Initialize data members.

Definition at line 350 of file CETime.cpp.

◆ Min()

double CETime::Min ( void  ) const
inline

Return the Minute associated with this time object.

Returns
Minute associated with this time object

Definition at line 153 of file CETime.h.

◆ operator=()

CETime & CETime::operator= ( const CETime other)

Copy assignment operator.

Parameters
[in]otherCETime object to be copied
Returns
Reference to this object post-copy

Definition at line 108 of file CETime.cpp.

◆ Sec()

double CETime::Sec ( void  ) const
inline

Return the Second associated with this time object.

Returns
Second associated with this time object

Definition at line 165 of file CETime.h.

◆ SetHours()

void CETime::SetHours ( const double &  hours)
inline

Definition at line 90 of file CETime.h.

◆ SetMinutes()

void CETime::SetMinutes ( const double &  minutes)
inline

Definition at line 92 of file CETime.h.

◆ SetSeconds()

void CETime::SetSeconds ( const double &  seconds)
inline

Definition at line 94 of file CETime.h.

◆ SetTime() [1/2]

void CETime::SetTime ( const double &  time,
CETimeType  time_format = CETimeType::UTC 
)

Set time from double of the form HHMMSS.SS and a specified time format.

Parameters
timeHHMMSS.SS formated time variable

Definition at line 194 of file CETime.cpp.

◆ SetTime() [2/2]

void CETime::SetTime ( std::vector< double >  time_vect,
CETimeType  time_format = CETimeType::UTC 
)

Set the time from a vector and a user specified format.

Parameters
time_vectvector specifying the time
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second
time_formatSpecifies what type is represented by 'time' (see CETimeType)

Definition at line 213 of file CETime.cpp.

◆ SetTime_GAST()

void CETime::SetTime_GAST ( std::vector< double >  time)
private

Set the time from a vector representing Greenwich Apparent Sidereal Time.

The elements are as follows: [0]=hours, [1]=minutes, [2]=whole seconds, [3]=fractional seconds

Definition at line 383 of file CETime.cpp.

◆ SetTime_LOCALTIME()

void CETime::SetTime_LOCALTIME ( std::vector< double >  time)
private

Set the time from a vector representing local observer time.

The elements are as follows: [0]=hours, [1]=minutes, [2]=whole seconds, [3]=fractional seconds

Definition at line 407 of file CETime.cpp.

◆ SetTime_LST()

void CETime::SetTime_LST ( std::vector< double >  time)
private

Set the time from a vector representing Local Sidereal Time.

Parameters
timeVector representing LST time
  • [0]=hours
  • [1]=minutes
  • [2]=whole seconds
  • [3]=fractional seconds

Definition at line 397 of file CETime.cpp.

◆ SetTime_UTC()

void CETime::SetTime_UTC ( std::vector< double >  time)
private

Set the time from a vector representing UTC time.

The elements are as follows: [0]=hours, [1]=minutes, [2]=whole seconds, [3]=fractional seconds

Definition at line 371 of file CETime.cpp.

◆ SystemUTCOffset_hrs()

static double CETime::SystemUTCOffset_hrs ( )
inlinestatic

Definition at line 74 of file CETime.h.

◆ TimeDbl2Vect()

std::vector< double > CETime::TimeDbl2Vect ( const double &  time)
static

Convert a time formatted as HHMMSS.SS into a vector.

Parameters
timeTime object formatted as HHMMSS.SS
Returns
Vector containing the various time components
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second

Definition at line 277 of file CETime.cpp.

◆ TimeSec2Time()

double CETime::TimeSec2Time ( const double &  seconds)
static

Convert number of seconds since midnight to HHMMSS.S formatted double.

Parameters
secondsSeconds since midnight
Returns
Time formatted as HHMMSS.S

Definition at line 300 of file CETime.cpp.

◆ TimeSec2Vect()

std::vector< double > CETime::TimeSec2Vect ( const double &  seconds)
static

Convert number of seconds since midnight to HHMMSS.S formatted double.

Parameters
secondsSeconds since midnight
Returns
Vector containing the various time components
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second

Definition at line 326 of file CETime.cpp.

◆ TimeVect2Dbl()

double CETime::TimeVect2Dbl ( std::vector< double >  time)
static

Convert a time formatted as HHMMSS.SS into a vector.

Parameters
timeVector containing the various time components
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second
Returns
Time formated double as HHMMSS.S

Definition at line 260 of file CETime.cpp.

◆ UTC()

double CETime::UTC ( const double &  mjd)
static

Get the current UTC time.

Parameters
mjdModified Julian date
Returns
Seconds since midnight for given Julian date

Definition at line 169 of file CETime.cpp.

◆ UTC2GAST()

void CETime::UTC2GAST ( )
static

Definition at line 229 of file CETime.cpp.

◆ UTC2LAST()

void CETime::UTC2LAST ( )
static

Definition at line 236 of file CETime.cpp.

◆ UTC2LOCALTIME()

void CETime::UTC2LOCALTIME ( )
static

Definition at line 243 of file CETime.cpp.

◆ UTC_vect()

std::vector< double > CETime::UTC_vect ( const double &  mjd)
static

Get the UTC time of a given julian date as a vector.

Parameters
mjdModified Julian date (with day fraction)
Returns
Vector containing the various time components
  • time[0] = hours
  • time[1] = minutes
  • time[2] = seconds
  • time[3] = fractions of a second

Definition at line 184 of file CETime.cpp.

Member Data Documentation

◆ time_

std::vector<double> CETime::time_
private

Definition at line 127 of file CETime.h.

◆ time_type_

CETimeType CETime::time_type_
private

Definition at line 128 of file CETime.h.


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