TwiceAsNice  2019-02-18
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Nice::Date Class Reference

#include <Date.h>

Inheritance diagram for Nice::Date:
Inheritance graph
Collaboration diagram for Nice::Date:
Collaboration graph

Public Member Functions

 Date (Nice::DateVar)
 Ctor. More...
 
 Date ()
 Default ctor. More...
 
 Date (const timespec &)
 Ctor. More...
 
 Date (const timeval &)
 Ctor. More...
 
 operator timeval () const
 convert the time to a timeval struct More...
 
 operator timespec () const
 
 operator time_t () const
 
 operator Time () const
 
Nice::I64 toMicroSeconds () const
 
Nice::I64 toNanoSeconds () const
 
struct tm toTimeStruct (bool _utc=false) const
 
Date date (bool _utc=false) const
 
std::string dateString (bool _utc=false) const
 
Time time (bool _utc=false) const
 
std::string timeString (bool _utc=false) const
 
std::string timeString (int _precision, bool _utc=false) const
 Convert the time into a human-readable string. More...
 
int year (bool _utc=false) const
 
int month (bool _utc=false) const
 
int day (bool _utc=false) const
 
int hour (bool _utc=false) const
 
int minute (bool _utc=false) const
 
int second (bool _utc=false) const
 
int microSecond () const
 
double toMicroSecondsDouble () const
 
 operator IceUtil::Time () const
 
double toEpoch () const
 Convert the time to an Epoch (UTC) More...
 
double toMJD () const
 Represent this as a modified Julian Date. More...
 
double toJD () const
 Represent this as a Julian Date. More...
 
std::string toString (bool _utc=false) const
 
std::string toString (int _precision, bool _utc=false, const char *_dateStr="%Y-%m-%d %H:%M:%S") const
 Convert the date/time into a human-readable string. More...
 
bool isValid ()
 
Time operator- (const Nice::Date &rhs) const
 
Date operator- (const Nice::Time &rhs) const
 
Date operator+ (const Nice::Time &rhs) const
 
Dateoperator+= (const Nice::Time &rhs)
 
Dateoperator-= (const Nice::Time &rhs)
 
bool operator< (const Date &rhs) const
 
bool operator<= (const Date &rhs) const
 
bool operator> (const Date &rhs) const
 
bool operator>= (const Date &rhs) const
 
bool operator== (const Date &rhs) const
 
bool operator!= (const Date &rhs) const
 
 Date (Nice::DateVar)
 
 Date ()
 
 Date (const timespec &)
 
 Date (const timeval &)
 
 operator timeval () const
 
 operator timespec () const
 
 operator time_t () const
 
 operator Time () const
 
Nice::I64 toMicroSeconds () const
 
Nice::I64 toNanoSeconds () const
 
struct tm toTimeStruct (bool _utc=false) const
 
Date date (bool _utc=false) const
 
std::string dateString (bool _utc=false) const
 
Time time (bool _utc=false) const
 
std::string timeString (bool _utc=false) const
 
std::string timeString (int _precision, bool _utc=false) const
 
int year (bool _utc=false) const
 
int month (bool _utc=false) const
 
int day (bool _utc=false) const
 
int hour (bool _utc=false) const
 
int minute (bool _utc=false) const
 
int second (bool _utc=false) const
 
int microSecond () const
 
double toMicroSecondsDouble () const
 
 operator IceUtil::Time () const
 
double toEpoch () const
 
double toMJD () const
 
double toJD () const
 
std::string toString (bool _utc=false) const
 
std::string toString (int _precision, bool _utc=false, const char *_dateStr="%Y-%m-%d %H:%M:%S") const
 
bool isValid ()
 
Time operator- (const Nice::Date &rhs) const
 
Date operator- (const Nice::Time &rhs) const
 
Date operator+ (const Nice::Time &rhs) const
 
Dateoperator+= (const Nice::Time &rhs)
 
Dateoperator-= (const Nice::Time &rhs)
 
bool operator< (const Date &rhs) const
 
bool operator<= (const Date &rhs) const
 
bool operator> (const Date &rhs) const
 
bool operator>= (const Date &rhs) const
 
bool operator== (const Date &rhs) const
 
bool operator!= (const Date &rhs) const
 
- Public Member Functions inherited from Nice::DateVar
bool operator== (const DateVar &__rhs) const
 
bool operator< (const DateVar &__rhs) const
 
bool operator!= (const DateVar &__rhs) const
 
bool operator<= (const DateVar &__rhs) const
 
bool operator> (const DateVar &__rhs) const
 
bool operator>= (const DateVar &__rhs) const
 
bool operator== (const DateVar &__rhs) const
 
bool operator< (const DateVar &__rhs) const
 
bool operator!= (const DateVar &__rhs) const
 
bool operator<= (const DateVar &__rhs) const
 
bool operator> (const DateVar &__rhs) const
 
bool operator>= (const DateVar &__rhs) const
 

Static Public Member Functions

static Date now ()
 Construct the time stamp at the time of the call. More...
 
static Date microSeconds (Nice::I64)
 convert the time to microseconds. More...
 
static Date nanoSeconds (Nice::I64)
 convert the time to nanoseconds. More...
 
static Date fromMJD (double _mjd)
 Construct a time stamp from modified Julian date. More...
 
static Date now ()
 
static Date microSeconds (Nice::I64)
 
static Date nanoSeconds (Nice::I64)
 
static Date fromMJD (double _mjd)
 

Protected Member Functions

 Date (Nice::I64)
 Ctor. More...
 
 Date (Nice::I64)
 

Additional Inherited Members

- Public Attributes inherited from Nice::DateVar
::Ice::Long nsec
 

Constructor & Destructor Documentation

◆ Date() [1/10]

Nice::Date::Date ( Nice::I64  _t)
protected

Ctor.

Set the time.

Parameters
_tNumber of nanoseconds since UNIX date zero

◆ Date() [2/10]

Nice::Date::Date ( Nice::DateVar  _t)

Ctor.

Set the time.

Parameters
_tNumber of nanoseconds since UNIX date zero

◆ Date() [3/10]

Nice::Date::Date ( )

Default ctor.

Unix date zero in 1970-01-01

Todo:
this should rather be the value "now" at the time of the call. RJM 2016-11-19

◆ Date() [4/10]

Nice::Date::Date ( const timespec &  _t)

Ctor.

Set the time.

Parameters
_tUNIX structe with seconds and nanoseconds.

◆ Date() [5/10]

Nice::Date::Date ( const timeval &  _t)

Ctor.

Set the time.

Parameters
_tUNIX structe with seconds and microseconds

◆ Date() [6/10]

Nice::Date::Date ( Nice::I64  )
protected

◆ Date() [7/10]

Nice::Date::Date ( Nice::DateVar  )

◆ Date() [8/10]

Nice::Date::Date ( )

◆ Date() [9/10]

Nice::Date::Date ( const timespec &  )

◆ Date() [10/10]

Nice::Date::Date ( const timeval &  )

Member Function Documentation

◆ date() [1/2]

Nice::Date Nice::Date::date ( bool  _utc = false) const

◆ date() [2/2]

Date Nice::Date::date ( bool  _utc = false) const

◆ dateString() [1/2]

std::string Nice::Date::dateString ( bool  _utc = false) const

◆ dateString() [2/2]

std::string Nice::Date::dateString ( bool  _utc = false) const

◆ day() [1/2]

int Nice::Date::day ( bool  _utc = false) const

◆ day() [2/2]

int Nice::Date::day ( bool  _utc = false) const

◆ fromMJD() [1/2]

static Date Nice::Date::fromMJD ( double  _mjd)
static

◆ fromMJD() [2/2]

Nice::Date Nice::Date::fromMJD ( double  _mjd)
static

Construct a time stamp from modified Julian date.

Parameters
_mjdthe modified Julian date
Returns
The equivalent representation as Nice::Date .

◆ hour() [1/2]

int Nice::Date::hour ( bool  _utc = false) const

◆ hour() [2/2]

int Nice::Date::hour ( bool  _utc = false) const

◆ isValid() [1/2]

bool Nice::Date::isValid ( )
inline

◆ isValid() [2/2]

bool Nice::Date::isValid ( )
inline

◆ microSecond() [1/2]

int Nice::Date::microSecond ( ) const

◆ microSecond() [2/2]

int Nice::Date::microSecond ( ) const

◆ microSeconds() [1/2]

Nice::Date Nice::Date::microSeconds ( Nice::I64  t)
static

convert the time to microseconds.


Returns
The microseconds since UNIX time 0.

◆ microSeconds() [2/2]

static Date Nice::Date::microSeconds ( Nice::I64  )
static

◆ minute() [1/2]

int Nice::Date::minute ( bool  _utc = false) const

◆ minute() [2/2]

int Nice::Date::minute ( bool  _utc = false) const

◆ month() [1/2]

int Nice::Date::month ( bool  _utc = false) const

◆ month() [2/2]

int Nice::Date::month ( bool  _utc = false) const

◆ nanoSeconds() [1/2]

static Date Nice::Date::nanoSeconds ( Nice::I64  )
static

◆ nanoSeconds() [2/2]

Nice::Date Nice::Date::nanoSeconds ( Nice::I64  t)
static

convert the time to nanoseconds.


Returns
The nanoseconds since UNIX time 0.

◆ now() [1/2]

Nice::Date Nice::Date::now ( )
static

Construct the time stamp at the time of the call.

Returns
The time "now"

◆ now() [2/2]

static Date Nice::Date::now ( )
static

◆ operator IceUtil::Time() [1/2]

Nice::Date::operator IceUtil::Time ( ) const

◆ operator IceUtil::Time() [2/2]

Nice::Date::operator IceUtil::Time ( ) const

◆ operator Time() [1/2]

Nice::Date::operator Time ( ) const

◆ operator Time() [2/2]

Nice::Date::operator Time ( ) const

◆ operator time_t() [1/2]

Nice::Date::operator time_t ( ) const

◆ operator time_t() [2/2]

Nice::Date::operator time_t ( ) const

◆ operator timespec() [1/2]

Nice::Date::operator timespec ( ) const

◆ operator timespec() [2/2]

Nice::Date::operator timespec ( ) const

◆ operator timeval() [1/2]

Nice::Date::operator timeval ( ) const

convert the time to a timeval struct


Returns
The Time measured in seconds and microseconds.

◆ operator timeval() [2/2]

Nice::Date::operator timeval ( ) const

◆ operator!=() [1/2]

bool Nice::Date::operator!= ( const Date rhs) const
inline

◆ operator!=() [2/2]

bool Nice::Date::operator!= ( const Date rhs) const
inline

◆ operator+() [1/2]

Date Nice::Date::operator+ ( const Nice::Time rhs) const
inline

◆ operator+() [2/2]

Date Nice::Date::operator+ ( const Nice::Time rhs) const
inline

◆ operator+=() [1/2]

Date& Nice::Date::operator+= ( const Nice::Time rhs)
inline

◆ operator+=() [2/2]

Date& Nice::Date::operator+= ( const Nice::Time rhs)
inline

◆ operator-() [1/4]

Time Nice::Date::operator- ( const Nice::Date rhs) const
inline

◆ operator-() [2/4]

Time Nice::Date::operator- ( const Nice::Date rhs) const
inline

◆ operator-() [3/4]

Date Nice::Date::operator- ( const Nice::Time rhs) const
inline

◆ operator-() [4/4]

Date Nice::Date::operator- ( const Nice::Time rhs) const
inline

◆ operator-=() [1/2]

Date& Nice::Date::operator-= ( const Nice::Time rhs)
inline

◆ operator-=() [2/2]

Date& Nice::Date::operator-= ( const Nice::Time rhs)
inline

◆ operator<() [1/2]

bool Nice::Date::operator< ( const Date rhs) const
inline

◆ operator<() [2/2]

bool Nice::Date::operator< ( const Date rhs) const
inline

◆ operator<=() [1/2]

bool Nice::Date::operator<= ( const Date rhs) const
inline

◆ operator<=() [2/2]

bool Nice::Date::operator<= ( const Date rhs) const
inline

◆ operator==() [1/2]

bool Nice::Date::operator== ( const Date rhs) const
inline

◆ operator==() [2/2]

bool Nice::Date::operator== ( const Date rhs) const
inline

◆ operator>() [1/2]

bool Nice::Date::operator> ( const Date rhs) const
inline

◆ operator>() [2/2]

bool Nice::Date::operator> ( const Date rhs) const
inline

◆ operator>=() [1/2]

bool Nice::Date::operator>= ( const Date rhs) const
inline

◆ operator>=() [2/2]

bool Nice::Date::operator>= ( const Date rhs) const
inline

◆ second() [1/2]

int Nice::Date::second ( bool  _utc = false) const

◆ second() [2/2]

int Nice::Date::second ( bool  _utc = false) const

◆ time() [1/2]

Nice::Time Nice::Date::time ( bool  _utc = false) const

◆ time() [2/2]

Time Nice::Date::time ( bool  _utc = false) const

◆ timeString() [1/4]

std::string Nice::Date::timeString ( bool  _utc = false) const
inline

◆ timeString() [2/4]

std::string Nice::Date::timeString ( bool  _utc = false) const
inline

◆ timeString() [3/4]

std::string Nice::Date::timeString ( int  _precision,
bool  _utc = false 
) const

Convert the time into a human-readable string.


Parameters
_precisionNumber of fractional seconds to be printed.
_utcIf true print a UTC string, else a string in the locale.

◆ timeString() [4/4]

std::string Nice::Date::timeString ( int  _precision,
bool  _utc = false 
) const

◆ toEpoch() [1/2]

double Nice::Date::toEpoch ( ) const

◆ toEpoch() [2/2]

double Nice::Date::toEpoch ( ) const

Convert the time to an Epoch (UTC)


Returns
The number of years (including fractions) since the epoch.

◆ toJD() [1/2]

double Nice::Date::toJD ( ) const

◆ toJD() [2/2]

double Nice::Date::toJD ( ) const

Represent this as a Julian Date.

Returns
the equivalent JD.

◆ toMicroSeconds() [1/2]

Nice::I64 Nice::Date::toMicroSeconds ( ) const

◆ toMicroSeconds() [2/2]

Nice::I64 Nice::Date::toMicroSeconds ( ) const

◆ toMicroSecondsDouble() [1/2]

double Nice::Date::toMicroSecondsDouble ( ) const

◆ toMicroSecondsDouble() [2/2]

double Nice::Date::toMicroSecondsDouble ( ) const

◆ toMJD() [1/2]

double Nice::Date::toMJD ( ) const

◆ toMJD() [2/2]

double Nice::Date::toMJD ( ) const

Represent this as a modified Julian Date.

Returns
the equivalent MJD.

◆ toNanoSeconds() [1/2]

Nice::I64 Nice::Date::toNanoSeconds ( ) const

◆ toNanoSeconds() [2/2]

Nice::I64 Nice::Date::toNanoSeconds ( ) const

◆ toString() [1/4]

std::string Nice::Date::toString ( bool  _utc = false) const
inline

◆ toString() [2/4]

std::string Nice::Date::toString ( bool  _utc = false) const
inline

◆ toString() [3/4]

std::string Nice::Date::toString ( int  _precision,
bool  _utc = false,
const char *  _dateStr = "%Y-%m-%d %H:%M:%S" 
) const

Convert the date/time into a human-readable string.


Parameters
_precisionNumber of fractional seconds to be printed.
_utcIf true print a UTC string, else a string in the locale.
__dateStrA formatting string as in strftime(3)

◆ toString() [4/4]

std::string Nice::Date::toString ( int  _precision,
bool  _utc = false,
const char *  _dateStr = "%Y-%m-%d %H:%M:%S" 
) const

◆ toTimeStruct() [1/2]

struct tm Nice::Date::toTimeStruct ( bool  _utc = false) const

◆ toTimeStruct() [2/2]

struct tm Nice::Date::toTimeStruct ( bool  _utc = false) const

◆ year() [1/2]

int Nice::Date::year ( bool  _utc = false) const

◆ year() [2/2]

int Nice::Date::year ( bool  _utc = false) const

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