bes  Updated for version 3.20.6
DODS_Decimal_Year Class Reference

#include <DODS_Decimal_Year.h>

Collaboration diagram for DODS_Decimal_Year:
Collaboration graph

Public Member Functions

Constructors
 DODS_Decimal_Year ()
 
 DODS_Decimal_Year (DODS_Date d)
 
 DODS_Decimal_Year (DODS_Date d, DODS_Time t)
 
 DODS_Decimal_Year (string date_time)
 
 DODS_Decimal_Year (BaseType *date_time)
 
 DODS_Decimal_Year (int y, int m, int d, int hh=0, int mm=0, double ss=0.0, bool gmt=false)
 
 DODS_Decimal_Year (int y, int yd, int hh=0, int mm=0, double ss=0.0, bool gmt=false)
 
Assignment
void set (DODS_Date d)
 
void set (DODS_Date d, DODS_Time t)
 
void set (string date_time)
 
void set (BaseType *date_time)
 
void set (int y, int m, int d, int hh=0, int mm=0, double ss=0.0, bool gmt=false)
 
void set (int y, int yd, int hh=0, int mm=0, double ss=0.0, bool gmt=false)
 
Access
int days_in_year () const
 
int year () const
 
double fraction () const
 
bool gmt () const
 
string get (date_format format=ymd, bool gmt=true) const
 
double julian_day () const
 
time_t unix_time () const
 

Relational operators

double get_epsilon () const
 
void set_epsilon (double eps)
 
bool OK () const
 
int operator== (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Equality. More...
 
int operator!= (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Inequality. More...
 
int operator< (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Less-than. More...
 
int operator> (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Greater-than. More...
 
int operator<= (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Less-than or Equal-to. More...
 
int operator>= (DODS_Decimal_Year &t1, DODS_Decimal_Year &t2)
 Greater-than or Equal-to. More...
 

Detailed Description

The DODS Date/Time class is used to represent and compute the new decimal_year values.

See also
DODS_Date
DODS_Time
Author
James Gallagher/Dan Holloway

Definition at line 47 of file DODS_Decimal_Year.h.

Constructor & Destructor Documentation

◆ DODS_Decimal_Year() [1/7]

DODS_Decimal_Year::DODS_Decimal_Year ( )

Create an empty instance. Will not pass the class invariant.

◆ DODS_Decimal_Year() [2/7]

DODS_Decimal_Year::DODS_Decimal_Year ( DODS_Date  d)

Create an instance using DODS_Date and DODS_Time objects.

Parameters
dA DODS_Date object.

◆ DODS_Decimal_Year() [3/7]

DODS_Decimal_Year::DODS_Decimal_Year ( DODS_Date  d,
DODS_Time  t 
)

Create an instance using DODS_Date and DODS_Time objects.

Parameters
dA DODS_Date object.
tA DODS_Time object.

◆ DODS_Decimal_Year() [4/7]

DODS_Decimal_Year::DODS_Decimal_Year ( string  date_time)

Create an instance using the string representation of a DODS_Date_Time.

Parameters
date_timeThe date/time string.

◆ DODS_Decimal_Year() [5/7]

DODS_Decimal_Year::DODS_Decimal_Year ( BaseType *  date_time)

Create an instance using the string representation of a DODS_Date_Time contained in a DODS Str.

Parameters
date_timeThe date/time string (in a DODS Str pointer).

◆ DODS_Decimal_Year() [6/7]

DODS_Decimal_Year::DODS_Decimal_Year ( int  y,
int  m,
int  d,
int  hh = 0,
int  mm = 0,
double  ss = 0.0,
bool  gmt = false 
)

Create an instance using numeric values for the year, ..., seconds.

Parameters
yThe year number, 1 is 1 A.D.
mThe month, 1 is January, ..., 12 is December.
dThe day.
hhThe hour, 0...23.
mmThe minute, 0...59.
ssThe seconds, 0.0, ..., 59.999...
gmtTrue if the time is a GMT time, false otherwise.

◆ DODS_Decimal_Year() [7/7]

DODS_Decimal_Year::DODS_Decimal_Year ( int  y,
int  yd,
int  hh = 0,
int  mm = 0,
double  ss = 0.0,
bool  gmt = false 
)

Create an instance using numeric values for the year, ..., seconds.

Parameters
yThe year number, 1 is 1 A.D.
ydThe year-day, 1 is 1 January, 365/366 is 31 December.
hhThe hour, 0...23.
mmThe minute, 0...59.
ssThe seconds, 0.0, ..., 59.999...
gmtTrue if the time is a GMT time, false otherwise.

Member Function Documentation

◆ days_in_year()

int DODS_Decimal_Year::days_in_year ( ) const
Returns
The number of days in the year.

◆ fraction()

double DODS_Decimal_Year::fraction ( ) const
Returns
The fractional representation of the year-day, seconds.

◆ get()

string DODS_Decimal_Year::get ( date_format  format = ymd,
bool  gmt = true 
) const

Get the string representation of the date/time. If #format# is #ymd#, return the date-time using yyyy/mm/dd:hh:mm:ss notation, if it is #yd#, use yyyy/ddd... notation. If gmt# is true, append GMT to times that are GMT times, if false, don't (ever) append the GMT suffix.

Parameters
formatThe format of the date-part.
gmtAppend the GMT suffix to GMT times.
Returns
The string representation f the date-time.

◆ get_epsilon()

double DODS_Decimal_Year::get_epsilon ( ) const

Get the value of epsilon used for equality tests of time.

◆ gmt()

bool DODS_Decimal_Year::gmt ( ) const
Returns
True if the time is a GMT time, false otherwise.

◆ julian_day()

double DODS_Decimal_Year::julian_day ( ) const
Returns
The Julian day number for this date and time. The time part of the day is represented as a fraction.

◆ OK()

bool DODS_Decimal_Year::OK ( ) const

Class invariant.

Returns
True if the instance is valid, false otherwise.

◆ set() [1/6]

void DODS_Decimal_Year::set ( BaseType *  date_time)

Set an instance using the string representation of a DODS_Date_Time contained in a DODS Str.

Parameters
date_timeThe date/time string (in a DODS Str pointer).

◆ set() [2/6]

void DODS_Decimal_Year::set ( DODS_Date  d)

Set an instance using DODS_Date objects.

Parameters
dA DODS_Date object.

◆ set() [3/6]

void DODS_Decimal_Year::set ( DODS_Date  d,
DODS_Time  t 
)

Set an instance using DODS_Date and DODS_Time objects.

Parameters
dA DODS_Date object.
tA DODS_Time object.

◆ set() [4/6]

void DODS_Decimal_Year::set ( int  y,
int  m,
int  d,
int  hh = 0,
int  mm = 0,
double  ss = 0.0,
bool  gmt = false 
)

Set an instance using numeric values for the year, ..., seconds.

Parameters
yThe year number, 1 is 1 A.D.
mThe month, 1 is January, ..., 12 is December.
dThe day.
hhThe hour, 0...23.
mmThe minute, 0...59.
ssThe seconds, 0.0, ..., 59.999...
gmtTrue if the time is a GMT time, false otherwise.

◆ set() [5/6]

void DODS_Decimal_Year::set ( int  y,
int  yd,
int  hh = 0,
int  mm = 0,
double  ss = 0.0,
bool  gmt = false 
)

Set an instance using numeric values for the year, ..., seconds.

Parameters
yThe year number, 1 is 1 A.D.
ydThe year-day, 1 is 1 January, 365/366 is 31 December.
hhThe hour, 0...23.
mmThe minute, 0...59.
ssThe seconds, 0.0, ..., 59.999...
gmtTrue if the time is a GMT time, false otherwise.

◆ set() [6/6]

void DODS_Decimal_Year::set ( string  date_time)

Set an instance using the string representation of a DODS_Date_Time.

Parameters
date_timeThe date/time string.

◆ set_epsilon()

void DODS_Decimal_Year::set_epsilon ( double  eps)

Set the value of epsilon used for equality tests of time. By default the value is 0.000001 (10e-6).

NB: This should rarely be changed.

◆ unix_time()

time_t DODS_Decimal_Year::unix_time ( ) const

Return the number of seconds since 00:00:00 UTC 1 Jan 1970. If the date is before 1 Jan 1970, return DODS_UINT_MAX. If the date is too late to represent as seconds since 1 Jan 1970, return DODS_UINT_MAX. Each day starts at 00:00:00 UTC.

Returns
The date in seconds since 1 Jan 1970.
See also
dods-limits.h
time.h
mktime(3)

◆ year()

int DODS_Decimal_Year::year ( ) const
Returns
The year in years A.D.

Friends And Related Function Documentation

◆ operator!=

int operator!= ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Inequality.

◆ operator<

int operator< ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Less-than.

◆ operator<=

int operator<= ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Less-than or Equal-to.

◆ operator==

int operator== ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Equality.

◆ operator>

int operator> ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Greater-than.

◆ operator>=

int operator>= ( DODS_Decimal_Year t1,
DODS_Decimal_Year t2 
)
friend

Greater-than or Equal-to.


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