Stellarium  HEAD
Public Member Functions | Static Public Member Functions
gTime Class Reference

This class implements time calculations. More...

#include <gTime.hpp>

Public Member Functions

 gTime (double ai_jDays=0)
 
 gTime (int year, double day)
 
 gTime (int nYear, int nMonth, int nDay, int nHour, int nMin, double nSec)
 
 gTime (struct tm ai_timestruct)
 
 gTime (const gTime &timeSrc)
 
void setTime (int year, double day)
 Set the time value of the time object to the julian day of year, day. More...
 
const gTimeoperator= (const gTime &timeSrc)
 overload de = operator to assign time values to he object. More...
 
const gTimeoperator= (time_t t)
 overload de = operator to assign time values to he object in time_t (operating system) format. More...
 
const gTimeoperator= (double t)
 overload the = operator to assign time values to the object in julian days. More...
 
double getGmtTm () const
 Returns the time GMT value in Julian days. More...
 
double getLocalTm () const
 Returns the time Local value in Julian days. More...
 
time_t toTime () const
 Returns the time_t value of the gTime Object. More...
 
void toCalendarDate (int *pYear, int *pMonth, double *pDom) const
 
double toJCenturies () const
 
double toThetaGMST () const
 Calculate Theta Angle at Greenwich Mean Time for the Julian date. More...
 
double toThetaLMST (double longitude) const
 Calculate Theta Angle at Local Mean Time for the Julian date. More...
 
gTimeSpan operator- (gTime time) const
 
gTime operator- (gTimeSpan timeSpan) const
 
gTime operator+ (gTimeSpan timeSpan) const
 
const gTimeoperator+= (gTimeSpan timeSpan)
 
const gTimeoperator-= (gTimeSpan timeSpan)
 
bool operator== (gTime time) const
 
bool operator!= (gTime time) const
 
bool operator< (gTime time) const
 
bool operator> (gTime time) const
 
bool operator<= (gTime time) const
 
bool operator>= (gTime time) const
 

Static Public Member Functions

static gTime getCurrentTime ()
 Returns a gTime object set with the actual machine time. More...
 
static gTimeSpan getTimeToUTC ()
 Returns a gTimeSpan object set with the Local Time Span set in the machine. More...
 
static bool isLeapYear (int ai_year)
 Leap Year Calculation. More...
 

Detailed Description

This class implements time calculations.

Time is stored in julian days

Member Function Documentation

◆ getCurrentTime()

static gTime gTime::getCurrentTime ( )
static

Returns a gTime object set with the actual machine time.

Warning
This method works with the operating system function time. So it doesn't support seconds fractions
Returns
gTime Object assigned with real machine time.

◆ getGmtTm()

double gTime::getGmtTm ( ) const

Returns the time GMT value in Julian days.

Returns
: double Julian Days represented in the gTime Object

◆ getLocalTm()

double gTime::getLocalTm ( ) const

Returns the time Local value in Julian days.

Returns
: double Julian Days represented in the gTime Object

◆ getTimeToUTC()

static gTimeSpan gTime::getTimeToUTC ( )
static

Returns a gTimeSpan object set with the Local Time Span set in the machine.

Returns
gTimeSpan Object assigned with the real machine GMT Diff.

◆ isLeapYear()

static bool gTime::isLeapYear ( int  ai_year)
inlinestatic

Leap Year Calculation.

This Operation uses the standard algorithm to calculate Leap Years. Reference: http://en.wikipedia.org/wiki/Leap_year

Parameters
ai_yearYear number
Returns
true if ai_year is a Leap Year

◆ operator=() [1/3]

const gTime& gTime::operator= ( const gTime timeSrc)

overload de = operator to assign time values to he object.

Parameters
timeSrcTime to be assigned
Returns
const gTime& Reference to *this object modified after operation

◆ operator=() [2/3]

const gTime& gTime::operator= ( double  t)
inline

overload the = operator to assign time values to the object in julian days.

Parameters
[in]tTime (JD) to be assigned
Returns
const gTime& Reference to *this object modified after operation

◆ operator=() [3/3]

const gTime& gTime::operator= ( time_t  t)

overload de = operator to assign time values to he object in time_t (operating system) format.

Parameters
[in]tTime to be assigned
Returns
const gTime& Reference to *this object modified after operation

◆ setTime()

void gTime::setTime ( int  year,
double  day 
)

Set the time value of the time object to the julian day of year, day.

References:
Astronomical Formulae for Calculators.
Jean Meeus
Chapter 3: Julian Day and Calendar Date. PG's 23, 24, 25

Parameters
[in]yeardate year
[in]daydate day and day fraction. Notice: 1 Jan is day=0 (not 1)

◆ toThetaGMST()

double gTime::toThetaGMST ( ) const

Calculate Theta Angle at Greenwich Mean Time for the Julian date.

The return value is the angle, in radians, measuring eastward from the Vernal Equinox to the prime meridian.
References:
Explanatory Supplement to the Astronomical Almanac, page 50. http://books.google.com/books?id=uJ4JhGJANb4C&lpg=PA52&hl=es&pg=PA50#v=onepage&q&f=false "Orbital Coordinate Systems, Part II." Dr. T.Kelzo Satellite Times, 2, no. 2 (November/December 1995): 78-79. https://celestrak.org/columns/v02n02/

Returns
Theta Angle in radians, measuring eastward from the Vernal Equinox to the prime meridian

◆ toThetaLMST()

double gTime::toThetaLMST ( double  longitude) const

Calculate Theta Angle at Local Mean Time for the Julian date.

Parameters
[in]longitudeGeographical longitude for the local meridian.
Positive longitude = east longitude
Negative longitude = west longitude
Returns
Theta Angle in radians, measuring eastward from the Vernal Equinox to the prime meridian

◆ toTime()

time_t gTime::toTime ( ) const

Returns the time_t value of the gTime Object.

Warning
time_t object doesn't support seconds fractions. This method must be avoid for astronomical calculation.
Returns
: time_t machine time represented in the gTime Object