bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
DODS_Date_Time Class Reference

#include <DODS_Date_Time.h>

Collaboration diagram for DODS_Date_Time:
Collaboration graph

Public Member Functions

Constructors
 DODS_Date_Time ()
 
 DODS_Date_Time (DODS_Date d, DODS_Time t)
 
 DODS_Date_Time (string date_time)
 
 DODS_Date_Time (BaseType *date_time)
 
 DODS_Date_Time (int y, int m, int d, int hh, int mm=0, double ss=0.0, bool gmt=false)
 
 DODS_Date_Time (int y, int yd, int hh, int mm=0, double ss=0.0, bool gmt=false)
 
Assignment
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, int mm=0, double ss=0.0, bool gmt=false)
 
void set (int y, int yd, int hh, int mm=0, double ss=0.0, bool gmt=false)
 
Access
int year () const
 
int month () const
 
int day () const
 
int day_number () const
 
int hours () const
 
int minutes () const
 
double seconds () 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_Date_Time &t1, DODS_Date_Time &t2)
 Equality.
 
int operator!= (DODS_Date_Time &t1, DODS_Date_Time &t2)
 Inequality.
 
int operator< (DODS_Date_Time &t1, DODS_Date_Time &t2)
 Less-than.
 
int operator> (DODS_Date_Time &t1, DODS_Date_Time &t2)
 Greater-than.
 
int operator<= (DODS_Date_Time &t1, DODS_Date_Time &t2)
 Less-than or Equal-to.
 
int operator>= (DODS_Date_Time &t1, DODS_Date_Time &t2)
 Greater-than or Equal-to.
 

Detailed Description

The DODS Date/Time class is used to represent and compute with combined date and time values.

See also
DODS_Date
DODS_Time
Author
James Gallagher

Definition at line 47 of file DODS_Date_Time.h.

Constructor & Destructor Documentation

◆ DODS_Date_Time() [1/6]

DODS_Date_Time::DODS_Date_Time ( )

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

Definition at line 89 of file DODS_Date_Time.cc.

◆ DODS_Date_Time() [2/6]

DODS_Date_Time::DODS_Date_Time ( 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.

Definition at line 94 of file DODS_Date_Time.cc.

◆ DODS_Date_Time() [3/6]

DODS_Date_Time::DODS_Date_Time ( string date_time)

Create an instance using the string representation of a DODS_Date_Time.

Parameters
date_timeThe date/time string.

Definition at line 98 of file DODS_Date_Time.cc.

◆ DODS_Date_Time() [4/6]

DODS_Date_Time::DODS_Date_Time ( 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).

Definition at line 103 of file DODS_Date_Time.cc.

◆ DODS_Date_Time() [5/6]

DODS_Date_Time::DODS_Date_Time ( int y,
int m,
int d,
int hh,
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.

Definition at line 108 of file DODS_Date_Time.cc.

◆ DODS_Date_Time() [6/6]

DODS_Date_Time::DODS_Date_Time ( int y,
int yd,
int hh,
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.

Definition at line 114 of file DODS_Date_Time.cc.

Member Function Documentation

◆ day()

int DODS_Date_Time::day ( ) const
Returns
The day of the month (1, ... {28, 29, 30, 31}.

Definition at line 259 of file DODS_Date_Time.cc.

◆ day_number()

int DODS_Date_Time::day_number ( ) const
Returns
The day-number of the year (1 = 1 Jan).

Definition at line 265 of file DODS_Date_Time.cc.

◆ get()

string DODS_Date_Time::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.

Definition at line 295 of file DODS_Date_Time.cc.

◆ get_epsilon()

double DODS_Date_Time::get_epsilon ( ) const

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

Definition at line 344 of file DODS_Date_Time.cc.

◆ gmt()

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

Definition at line 289 of file DODS_Date_Time.cc.

◆ hours()

int DODS_Date_Time::hours ( ) const
Returns
The number of hours.

Definition at line 271 of file DODS_Date_Time.cc.

◆ julian_day()

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

Definition at line 323 of file DODS_Date_Time.cc.

◆ minutes()

int DODS_Date_Time::minutes ( ) const
Returns
The number of minutes.

Definition at line 277 of file DODS_Date_Time.cc.

◆ month()

int DODS_Date_Time::month ( ) const
Returns
The month of the year (1 == January, ..., 12 == December).

Definition at line 253 of file DODS_Date_Time.cc.

◆ OK()

bool DODS_Date_Time::OK ( ) const

Class invariant.

Returns
True if the instance is valid, false otherwise.

Definition at line 84 of file DODS_Date_Time.cc.

◆ seconds()

double DODS_Date_Time::seconds ( ) const
Returns
The number of seconds.

Definition at line 283 of file DODS_Date_Time.cc.

◆ set() [1/5]

void DODS_Date_Time::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).

Definition at line 223 of file DODS_Date_Time.cc.

◆ set() [2/5]

void DODS_Date_Time::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.

Definition at line 121 of file DODS_Date_Time.cc.

◆ set() [3/5]

void DODS_Date_Time::set ( int y,
int m,
int d,
int hh,
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.

Definition at line 229 of file DODS_Date_Time.cc.

◆ set() [4/5]

void DODS_Date_Time::set ( int y,
int yd,
int hh,
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.

Definition at line 238 of file DODS_Date_Time.cc.

◆ set() [5/5]

void DODS_Date_Time::set ( string date_time)

Set an instance using the string representation of a DODS_Date_Time.

Parameters
date_timeThe date/time string.

Definition at line 203 of file DODS_Date_Time.cc.

◆ set_epsilon()

void DODS_Date_Time::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.

Definition at line 350 of file DODS_Date_Time.cc.

◆ unix_time()

time_t DODS_Date_Time::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)

Definition at line 329 of file DODS_Date_Time.cc.

◆ year()

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

Definition at line 247 of file DODS_Date_Time.cc.

Friends And Related Symbol Documentation

◆ operator!=

int operator!= ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Inequality.

Definition at line 362 of file DODS_Date_Time.cc.

◆ operator<

int operator< ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Less-than.

Definition at line 367 of file DODS_Date_Time.cc.

◆ operator<=

int operator<= ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Less-than or Equal-to.

Definition at line 381 of file DODS_Date_Time.cc.

◆ operator==

int operator== ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Equality.

Definition at line 356 of file DODS_Date_Time.cc.

◆ operator>

int operator> ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Greater-than.

Definition at line 375 of file DODS_Date_Time.cc.

◆ operator>=

int operator>= ( DODS_Date_Time & t1,
DODS_Date_Time & t2 )
friend

Greater-than or Equal-to.

Definition at line 388 of file DODS_Date_Time.cc.


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