A class to handle timestamps. This class handles conversion between different time display formats (ISO, numeric) as well as different time representation (julian date, modified julian date, etc). It also handles time zones as well as very basic Daylight Saving Time (DST). Since the activation dates of DST are political and not technical, it can not be automatically calculated. Therefore, it has to be provided by the caller: when the dst flag is set, the dst time shift is automatically applied. When the dst flag ceases to be set, the dst time shift is no longer applied. This is very crude, but please keep in mind that using DST for monitoring data is usually a bad idea... Finally, we assume that dates are positive. If this would not be the case, this class has to be recompiled with the proper define.
Internally, the date is stored as true julian date in GMT. The maximal precision is 0.01 second (however with the limitation that leap seconds are currently not handled).
Please see Date::FORMATS for supported display formats and http://en.wikipedia.org/wiki/Julian_day for the various date representation definitions. The following date representation are currently supported:
When parsing a string to extract a date (using IOUtils::convertString), various string representations are supported (the timezone term {TZ} is optional if a fallback timezone is available, most probably as Input::TIME_ZONE in the configuration file) with their reduced accuracy variations (see below):
The timezone information {TZ} is as laid out in Date::parseTimeZone. Reduced accuracy means that any number of values may be dropped from the last to the most significant from the date and time representation.
#include <Date.h>
Public Types | |
enum | FORMATS { ISO , ISO_TZ , ISO_Z , FULL , NUM , DIN , ISO_WEEK , ISO_DATE } |
Keywords for selecting the date formats (the subsecond resolution is dropped when not needed) More... | |
enum | RND { UP , DOWN , CLOSEST } |
Keywords for selecting rounding strategy. More... | |
Public Member Functions | |
Date () | |
Default constructor: timezone is set to GMT without DST, julian date is set to 0 (meaning -4713-01-01T12:00) More... | |
Date (const double &in_timezone) | |
Current date constructor: the object is created with the current system date and time. More... | |
Date (const double &julian_in, const double &in_timezone) | |
Julian date constructor. More... | |
Date (const int &year, const int &month, const int &day, const int &hour, const int &minute, const double &in_timezone) | |
Date constructor by elements. All values are checked for plausibility. More... | |
Date (const int &year, const int &month, const int &day, const int &hour, const int &minute, const int &second, const double &in_timezone) | |
Date (const int &year, const int &month, const int &day, const int &hour, const int &minute, const double &second, const double &in_timezone) | |
Date (const time_t &) | |
Unix date constructor. More... | |
Date (const int &year, const double &jdn, const double &in_timezone) | |
Julian Day Number (JDN) constructor. More... | |
void | setFromSys () |
Set internal gmt time from system time as well as system time zone. More... | |
void | setTimeZone (const double &in_timezone) |
Set timezone and Daylight Saving Time flag. More... | |
void | setDate (const Date &in_date) |
Copy setter. More... | |
void | setDate (const double &julian_in, const double &in_timezone) |
Set date from a julian date (JD). More... | |
void | setDate (const int &year, const int &month, const int &day, const int &hour, const int &minute, const double &in_timezone) |
Set date by elements. All values are checked for plausibility. More... | |
void | setDate (const int &year, const int &month, const int &day, const int &hour, const int &minute, const int &second, const double &in_timezone) |
Set date by elements. All values are checked for plausibility. More... | |
void | setDate (const int &year, const int &month, const int &day, const int &hour, const int &minute, const double &second, const double &in_timezone) |
Set date by elements. All values are checked for plausibility. More... | |
void | setDate (const int &year, const unsigned int &month, const unsigned int &day, const unsigned int &hour, const unsigned int &minute, const double &in_timezone) |
void | setDate (const int &year, const unsigned int &month, const unsigned int &day, const unsigned int &hour, const unsigned int &minute, const unsigned int &second, const double &in_timezone) |
void | setDate (const int &year, const unsigned int &month, const unsigned int &day, const unsigned int &hour, const unsigned int &minute, const double &second, const double &in_timezone) |
void | setDate (const int &year, const double &jdn, const double &in_timezone) |
Set date from a year and Julian Day Number (JDN). More... | |
void | setDate (const time_t &in_time) |
Set date from a Unix date. More... | |
void | setModifiedJulianDate (const double &julian_in, const double &in_timezone) |
Set date from a modified julian date (MJD). More... | |
void | setRFC868Date (const double &julian_in, const double &in_timezone) |
Set date from an RFC868 date (time since 1900-01-01T00:00 GMT, valid until 2036). More... | |
void | setUnixDate (const time_t &in_time) |
Set date from a Unix date. More... | |
void | setExcelDate (const double excel_in, const double &in_timezone) |
Set date from an Excel date. More... | |
void | setMatlabDate (const double matlab_in, const double &in_timezone) |
Set date from an Matlab date. More... | |
void | setUndef (const bool &flag=true) |
bool | isUndef () const |
double | getTimeZone () const |
Returns timezone. More... | |
double | getJulian (const bool &gmt=false) const |
Return julian date (JD). The julian date is defined as the fractional number of days since -4713-01-01T12:00 UTC. More... | |
double | getModifiedJulianDate (const bool &gmt=false) const |
Return modified julian date (MJD). The modified julian date is defined as the fractional number of days since 1858-11-17T00:00 UTC (definition by the Smithsonian Astrophysical Observatory, MA). More... | |
double | getTruncatedJulianDate (const bool &gmt=false) const |
Return truncated julian date (TJD). The truncated julian date is defined as the julian day shifted to start at 00:00 and modulo 10000 days. The last origin (ie: 0) was 1995-10-10T00:00 (definition by National Institute of Standards and Technology). More... | |
double | getRFC868Date (const bool &gmt=false) const |
Return RFC868 date. The RFC868 date is defined as the fractional number of days since 1900-01-01T00:00 GMT. More... | |
time_t | getUnixDate () const |
Return Unix time (or POSIX time). The Unix time is defined as the number of seconds since 1970-01-01T00:00 UTC (Unix Epoch). It is therefore ALWAYS in GMT. (defined as IEEE P1003.1 POSIX. See http://www.mail-archive.com/leapsecs@rom.usno.navy.mil/msg00109.html for some technical, historical and funny insight into the standardization process) More... | |
double | getExcelDate (const bool &gmt=false) const |
Return Excel date. The (sick) Excel date is defined as the number of days since 1900-01-00T00:00 (no, this is NOT a typo). Moreover, it (wrongly) considers that 1900 was a leap year (in order to remain compatible with an old Lotus123 bug). This practically means that for dates after 1900-03-01, an Excel date really represents the number of days since 1900-01-01T00:00 PLUS 2. More... | |
double | getMatlabDate (const bool &gmt=false) const |
Return Matlab date. This is the number of days since 0000-01-01T00:00:00. See http://www.mathworks.com/help/techdoc/ref/datenum.html. More... | |
void | getDate (double &julian_out, const bool &gmt=false) const |
Retrieve julian date. This method is a candidate for deletion: it should now be obsolete. More... | |
void | getDate (int &year, int &month, int &day, const bool &gmt=false) const |
Return year, month, day. More... | |
void | getDate (int &year, int &month, int &day, int &hour, const bool &gmt=false) const |
Return year, month, day. More... | |
void | getDate (int &year, int &month, int &day, int &hour, int &minute, const bool &gmt=false) const |
Return year, month, day. More... | |
void | getDate (int &year, int &month, int &day, int &hour, int &minute, double &second, const bool &gmt=false) const |
Return year, month, day. More... | |
void | getDate (int &year, int &month, int &day, int &hour, int &minute, int &second, const bool &gmt=false) const |
void | getTime (int &hour_out, int &minute_out, const bool &gmt=false) const |
Return time of the day. More... | |
void | getTime (int &hour_out, int &minute_out, double &second_out, const bool &gmt=false) const |
Return time of the day. More... | |
int | getYear (const bool &gmt=false) const |
Return year. More... | |
unsigned short | getDayOfWeek (const bool &gmt=false) const |
Return the day of the week for the current date. The day of the week is between 1 (Monday) and 7 (Sunday). More... | |
unsigned short | getISOWeekNr (const bool &gmt=false) const |
Return the ISO 8601 week number The week number range from 1 to 53 for a leap year. The first week is the week that contains the first Thursday of the year. Previous days are attributed to the last week of the previous year (See https://en.wikipedia.org/wiki/ISO_week_date). More... | |
unsigned short | getISOWeekNr (int &ISO_year, const bool &gmt=false) const |
Return the ISO 8601 week number The week number range from 1 to 53 for a leap year. The first week is the week that contains the first Thursday of the year. Previous days are attributed to the last week of the previous year (See https://en.wikipedia.org/wiki/ISO_week_date). More... | |
int | getJulianDayNumber (const bool &gmt=false) const |
Return the julian day for the current date. Return the day of the year index for the current Date object. More... | |
bool | isLeapYear () const |
Return true if the current year is a leap year. More... | |
void | rnd (const double &precision, const RND &type=CLOSEST) |
Round date to a given precision. More... | |
const std::string | toString (const FORMATS &type, const bool &gmt=false) const |
Return a nicely formated string. More... | |
const std::string | toString () const |
bool | operator== (const Date &) const |
bool | operator!= (const Date &) const |
bool | operator< (const Date &) const |
bool | operator<= (const Date &) const |
bool | operator> (const Date &) const |
bool | operator>= (const Date &) const |
Date & | operator+= (const Date &) |
Date & | operator-= (const Date &) |
Date & | operator+= (const double &) |
Date & | operator-= (const double &) |
Date & | operator*= (const double &) |
Date & | operator/= (const double &) |
const Date | operator+ (const Date &) const |
const Date | operator- (const Date &) const |
const Date | operator+ (const double &) const |
const Date | operator- (const double &) const |
const Date | operator* (const double &) const |
const Date | operator/ (const double &) const |
Static Public Member Functions | |
static unsigned int | mod (const double &julian, const unsigned int &seconds) |
Modulus of a julian date by a given number of seconds. This returns the modulus (in seconds) of a given date by the given number of seconds. More... | |
static unsigned int | mod (const Date &indate, const unsigned int &seconds) |
Modulus of a date by a given number of seconds. This returns the modulus (in seconds) of a given date by the given number of seconds. More... | |
static double | rnd (const double &julian, const double &precision, const RND &type=CLOSEST) |
Round a julian date to a given precision. If you want to round a local date, do NOT provide it as gmt julian but as local julian, otherwise things like rounding to the next day would be shifted by TimeZone. More... | |
static const Date | rnd (const Date &indate, const double &precision, const RND &type=CLOSEST) |
static double | parseTimeZone (const std::string &timezone_iso) |
Parse an ISO 8601 formatted time zone specification. Time zones MUST be specified right after a date/time/combined representation according to the following formats: More... | |
static std::string | printFractionalDay (const double &fractional) |
Nicely format an hour given as fractional day into a human readable hour. More... | |
Static Public Attributes | |
static const double | DST_shift = 1.0 |
static const double | MJD_offset = 2400000.5 |
offset between julian date and modified julian date More... | |
static const double | RFC868_offset = 2415020.5 |
offset between julian date and RFC868 time (ref is 1900-01-01T00:00 GMT) More... | |
static const double | Unix_offset = 2440587.5 |
offset between julian date and Unix Epoch time More... | |
static const double | Excel_offset = 2415018.5 |
offset between julian date and Excel dates (note that excel invented some days...) More... | |
static const double | Matlab_offset = 1721058.5 |
offset between julian date and Matlab dates More... | |
static const double | epsilon_sec = 0.01 |
static const double | epsilon = epsilon_sec / (24.*3600.025) |
minimum difference between two dates in days. 3600.025 is intentional to support high sampling rates More... | |
Protected Member Functions | |
double | localToGMT (const double &in_julian) const |
double | GMTToLocal (const double &in_gmt_julian) const |
Static Protected Member Functions | |
static double | calculateJulianDate (const int &in_year, const int &in_month, const int &in_day, const int &in_hour, const int &in_minute, const double &i_second) |
static void | calculateDate (const double &i_julian, int &out_year, int &out_month, int &out_day) |
Calculate the date components (y,m,d) from a given julian date. More... | |
static void | calculateTime (const double &i_julian, int &o_hour, int &o_minute, double &o_second) |
Calculate the time components (y,m,d) from a given julian date. More... | |
static void | calculateValues (const double &i_julian, int &out_year, int &out_month, int &out_day, int &out_hour, int &out_minute, double &o_second) |
static long | getJulianDayNumber (const int &, const int &, const int &) |
static bool | isLeapYear (const int &) |
static void | plausibilityCheck (const int &in_year, const int &in_month, const int &in_day, const int &in_hour, const int &in_minute, const double &in_second) |
static bool | initStaticData () |
initialize the static map TZAbbrev More... | |
Protected Attributes | |
double | timezone |
double | gmt_julian |
bool | undef |
Static Protected Attributes | |
static std::map< std::string, double > | TZAbbrev |
static const int | daysLeapYear [] = {31,29,31,30,31,30,31,31,30,31,30,31} |
static const int | daysNonLeapYear [] = {31,28,31,30,31,30,31,31,30,31,30,31} |
static const bool | __init = Date::initStaticData() |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Date &date) |
std::istream & | operator>> (std::istream &is, Date &date) |
enum mio::Date::FORMATS |
Keywords for selecting the date formats (the subsecond resolution is dropped when not needed)
enum mio::Date::RND |
mio::Date::Date | ( | ) |
Default constructor: timezone is set to GMT without DST, julian date is set to 0 (meaning -4713-01-01T12:00)
mio::Date::Date | ( | const double & | in_timezone | ) |
Current date constructor: the object is created with the current system date and time.
in_timezone | timezone as an offset to GMT (in hours) |
mio::Date::Date | ( | const double & | julian_in, |
const double & | in_timezone | ||
) |
Julian date constructor.
julian_in | julian date to set |
in_timezone | timezone as an offset to GMT (in hours) |
mio::Date::Date | ( | const int & | in_year, |
const int & | in_month, | ||
const int & | in_day, | ||
const int & | in_hour, | ||
const int & | in_minute, | ||
const double & | in_timezone | ||
) |
Date constructor by elements. All values are checked for plausibility.
in_year | in 4 digits |
in_month | please keep in mind that first month of the year is 1 (ie: not 0!) |
in_day | please keep in mind that first day of the month is 1 (ie: not 0!) |
in_hour | |
in_minute | |
in_timezone | timezone as an offset to GMT (in hours, optional) |
mio::Date::Date | ( | const int & | year, |
const int & | month, | ||
const int & | day, | ||
const int & | hour, | ||
const int & | minute, | ||
const int & | second, | ||
const double & | in_timezone | ||
) |
mio::Date::Date | ( | const int & | year, |
const int & | month, | ||
const int & | day, | ||
const int & | hour, | ||
const int & | minute, | ||
const double & | second, | ||
const double & | in_timezone | ||
) |
mio::Date::Date | ( | const time_t & | in_time | ) |
Unix date constructor.
in_time | unix time (ie: as number of seconds since Unix Epoch, always UTC) |
mio::Date::Date | ( | const int & | year, |
const double & | jdn, | ||
const double & | in_timezone | ||
) |
Julian Day Number (JDN) constructor.
year | year to set |
jdn | Julian Day Number within the provided year |
in_timezone | timezone as an offset to GMT (in hours, optional) |
|
staticprotected |
Calculate the date components (y,m,d) from a given julian date.
This comes from Fliegel, H. F. and van Flandern, T. C. 1968. Letters to the editor: a machine algorithm for processing calendar dates; Commun. ACM 11, 10 (Oct. 1968), 657. DOI= http://doi.acm.org/10.1145/364096.364097
[in] | i_julian | julian date |
[out] | o_year | the extracted year |
[out] | o_month | the extracted month |
[out] | o_day | the extracted day |
|
staticprotected |
|
staticprotected |
Calculate the time components (y,m,d) from a given julian date.
[in] | i_julian | julian date |
[out] | o_hour | the extracted hour of the day |
[out] | o_minute | the extracted minutes |
[out] | o_second | the extracted seconds |
|
staticprotected |
void mio::Date::getDate | ( | double & | julian_out, |
const bool & | gmt = false |
||
) | const |
Retrieve julian date. This method is a candidate for deletion: it should now be obsolete.
julian_out | julian date (in local time zone or GMT depending on the gmt flag) |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getDate | ( | int & | year_out, |
int & | month_out, | ||
int & | day_out, | ||
const bool & | gmt = false |
||
) | const |
Return year, month, day.
year_out | |
month_out | |
day_out | |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getDate | ( | int & | year_out, |
int & | month_out, | ||
int & | day_out, | ||
int & | hour_out, | ||
const bool & | gmt = false |
||
) | const |
Return year, month, day.
year_out | |
month_out | |
day_out | |
hour_out | |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getDate | ( | int & | year_out, |
int & | month_out, | ||
int & | day_out, | ||
int & | hour_out, | ||
int & | minute_out, | ||
const bool & | gmt = false |
||
) | const |
Return year, month, day.
year_out | |
month_out | |
day_out | |
hour_out | |
minute_out | |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getDate | ( | int & | year_out, |
int & | month_out, | ||
int & | day_out, | ||
int & | hour_out, | ||
int & | minute_out, | ||
double & | second_out, | ||
const bool & | gmt = false |
||
) | const |
Return year, month, day.
year_out | |
month_out | |
day_out | |
hour_out | |
minute_out | |
second_out | |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getDate | ( | int & | year, |
int & | month, | ||
int & | day, | ||
int & | hour, | ||
int & | minute, | ||
int & | second, | ||
const bool & | gmt = false |
||
) | const |
unsigned short mio::Date::getDayOfWeek | ( | const bool & | gmt = false | ) | const |
Return the day of the week for the current date. The day of the week is between 1 (Monday) and 7 (Sunday).
gmt | convert returned value to GMT? (default: false) |
double mio::Date::getExcelDate | ( | const bool & | gmt = false | ) | const |
Return Excel date. The (sick) Excel date is defined as the number of days since 1900-01-00T00:00 (no, this is NOT a typo). Moreover, it (wrongly) considers that 1900 was a leap year (in order to remain compatible with an old Lotus123 bug). This practically means that for dates after 1900-03-01, an Excel date really represents the number of days since 1900-01-01T00:00 PLUS 2.
gmt | convert returned value to GMT? (default: false) |
unsigned short mio::Date::getISOWeekNr | ( | const bool & | gmt = false | ) | const |
Return the ISO 8601 week number The week number range from 1 to 53 for a leap year. The first week is the week that contains the first Thursday of the year. Previous days are attributed to the last week of the previous year (See https://en.wikipedia.org/wiki/ISO_week_date).
gmt | convert returned value to GMT? (default: false) |
unsigned short mio::Date::getISOWeekNr | ( | int & | ISO_year, |
const bool & | gmt = false |
||
) | const |
Return the ISO 8601 week number The week number range from 1 to 53 for a leap year. The first week is the week that contains the first Thursday of the year. Previous days are attributed to the last week of the previous year (See https://en.wikipedia.org/wiki/ISO_week_date).
[out] | ISO_year | get filled with the matching ISO year (since the fist/last few days might belong to the previous/next year) |
gmt | convert returned value to GMT? (default: false) |
double mio::Date::getJulian | ( | const bool & | gmt = false | ) | const |
Return julian date (JD). The julian date is defined as the fractional number of days since -4713-01-01T12:00 UTC.
gmt | convert returned value to GMT? (default: false) |
int mio::Date::getJulianDayNumber | ( | const bool & | gmt = false | ) | const |
Return the julian day for the current date. Return the day of the year index for the current Date object.
gmt | convert returned value to GMT? (default: false) |
|
staticprotected |
double mio::Date::getMatlabDate | ( | const bool & | gmt = false | ) | const |
Return Matlab date. This is the number of days since 0000-01-01T00:00:00. See http://www.mathworks.com/help/techdoc/ref/datenum.html.
gmt | convert returned value to GMT? (default: false) |
double mio::Date::getModifiedJulianDate | ( | const bool & | gmt = false | ) | const |
Return modified julian date (MJD). The modified julian date is defined as the fractional number of days since 1858-11-17T00:00 UTC (definition by the Smithsonian Astrophysical Observatory, MA).
gmt | convert returned value to GMT? (default: false) |
double mio::Date::getRFC868Date | ( | const bool & | gmt = false | ) | const |
Return RFC868 date. The RFC868 date is defined as the fractional number of days since 1900-01-01T00:00 GMT.
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getTime | ( | int & | hour_out, |
int & | minute_out, | ||
const bool & | gmt = false |
||
) | const |
Return time of the day.
hour_out | |
minute_out | |
gmt | convert returned value to GMT? (default: false) |
void mio::Date::getTime | ( | int & | hour_out, |
int & | minute_out, | ||
double & | second_out, | ||
const bool & | gmt = false |
||
) | const |
Return time of the day.
hour_out | |
minute_out | |
second_out | |
gmt | convert returned value to GMT? (default: false) |
double mio::Date::getTimeZone | ( | ) | const |
Returns timezone.
double mio::Date::getTruncatedJulianDate | ( | const bool & | gmt = false | ) | const |
Return truncated julian date (TJD). The truncated julian date is defined as the julian day shifted to start at 00:00 and modulo 10000 days. The last origin (ie: 0) was 1995-10-10T00:00 (definition by National Institute of Standards and Technology).
gmt | convert returned value to GMT? (default: false) |
time_t mio::Date::getUnixDate | ( | ) | const |
Return Unix time (or POSIX time). The Unix time is defined as the number of seconds since 1970-01-01T00:00 UTC (Unix Epoch). It is therefore ALWAYS in GMT. (defined as IEEE P1003.1 POSIX. See http://www.mail-archive.com/leapsecs@rom.usno.navy.mil/msg00109.html for some technical, historical and funny insight into the standardization process)
int mio::Date::getYear | ( | const bool & | gmt = false | ) | const |
Return year.
gmt | convert returned value to GMT? (default: false) |
|
protected |
|
staticprotected |
initialize the static map TZAbbrev
bool mio::Date::isLeapYear | ( | ) | const |
Return true if the current year is a leap year.
|
staticprotected |
|
inline |
|
protected |
|
static |
Modulus of a date by a given number of seconds. This returns the modulus (in seconds) of a given date by the given number of seconds.
[in] | indate | input date |
[in] | seconds | period (in seconds) |
|
static |
Modulus of a julian date by a given number of seconds. This returns the modulus (in seconds) of a given date by the given number of seconds.
[in] | julian | input date |
[in] | seconds | period (in seconds) |
bool mio::Date::operator!= | ( | const Date & | indate | ) | const |
const Date mio::Date::operator* | ( | const double & | value | ) | const |
Date & mio::Date::operator*= | ( | const double & | value | ) |
const Date mio::Date::operator+ | ( | const double & | indate | ) | const |
Date & mio::Date::operator+= | ( | const double & | indate | ) |
const Date mio::Date::operator- | ( | const double & | indate | ) | const |
Date & mio::Date::operator-= | ( | const double & | indate | ) |
const Date mio::Date::operator/ | ( | const double & | value | ) | const |
Date & mio::Date::operator/= | ( | const double & | value | ) |
bool mio::Date::operator< | ( | const Date & | indate | ) | const |
bool mio::Date::operator<= | ( | const Date & | indate | ) | const |
bool mio::Date::operator== | ( | const Date & | indate | ) | const |
bool mio::Date::operator> | ( | const Date & | indate | ) | const |
bool mio::Date::operator>= | ( | const Date & | indate | ) | const |
|
static |
Parse an ISO 8601 formatted time zone specification. Time zones MUST be specified right after a date/time/combined representation according to the following formats:
timezone_iso | time zone string |
|
staticprotected |
|
static |
Nicely format an hour given as fractional day into a human readable hour.
fractional | fractional day (ie: fractional part of a julian date) |
|
static |
|
static |
Round a julian date to a given precision. If you want to round a local date, do NOT provide it as gmt julian but as local julian, otherwise things like rounding to the next day would be shifted by TimeZone.
julian | date to round |
precision | round date to the given precision, in seconds |
type | rounding strategy (default: CLOSEST) |
Round date to a given precision.
precision | round date to the given precision, in seconds |
type | rounding strategy (default: CLOSEST) |
void mio::Date::setDate | ( | const double & | julian_in, |
const double & | in_timezone | ||
) |
Set date from a julian date (JD).
julian_in | julian date to set |
in_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setDate | ( | const int & | year, |
const double & | jdn, | ||
const double & | in_timezone | ||
) |
Set date from a year and Julian Day Number (JDN).
year | year to set |
jdn | Julian Day Number within the provided year (1 to 365/366), starting at 00:00 |
in_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setDate | ( | const int & | i_year, |
const int & | i_month, | ||
const int & | i_day, | ||
const int & | i_hour, | ||
const int & | i_minute, | ||
const double & | i_timezone | ||
) |
Set date by elements. All values are checked for plausibility.
i_year | in 4 digits |
i_month | please keep in mind that first month of the year is 1 (ie: not 0!) |
i_day | please keep in mind that first day of the month is 1 (ie: not 0!) |
i_hour | |
i_minute | |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setDate | ( | const int & | i_year, |
const int & | i_month, | ||
const int & | i_day, | ||
const int & | i_hour, | ||
const int & | i_minute, | ||
const double & | i_second, | ||
const double & | i_timezone | ||
) |
Set date by elements. All values are checked for plausibility.
i_year | in 4 digits |
i_month | please keep in mind that first month of the year is 1 (ie: not 0!) |
i_day | please keep in mind that first day of the month is 1 (ie: not 0!) |
i_hour | |
i_minute | |
i_second | |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setDate | ( | const int & | i_year, |
const int & | i_month, | ||
const int & | i_day, | ||
const int & | i_hour, | ||
const int & | i_minute, | ||
const int & | i_second, | ||
const double & | i_timezone | ||
) |
Set date by elements. All values are checked for plausibility.
i_year | in 4 digits |
i_month | please keep in mind that first month of the year is 1 (ie: not 0!) |
i_day | please keep in mind that first day of the month is 1 (ie: not 0!) |
i_hour | |
i_minute | |
i_second | |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setDate | ( | const int & | year, |
const unsigned int & | month, | ||
const unsigned int & | day, | ||
const unsigned int & | hour, | ||
const unsigned int & | minute, | ||
const double & | in_timezone | ||
) |
void mio::Date::setDate | ( | const int & | year, |
const unsigned int & | month, | ||
const unsigned int & | day, | ||
const unsigned int & | hour, | ||
const unsigned int & | minute, | ||
const double & | second, | ||
const double & | in_timezone | ||
) |
void mio::Date::setDate | ( | const int & | year, |
const unsigned int & | month, | ||
const unsigned int & | day, | ||
const unsigned int & | hour, | ||
const unsigned int & | minute, | ||
const unsigned int & | second, | ||
const double & | in_timezone | ||
) |
void mio::Date::setDate | ( | const time_t & | i_time | ) |
Set date from a Unix date.
i_time | unix time (ie: as number of seconds since Unix Epoch, assumed to always be UTC+0) |
void mio::Date::setExcelDate | ( | const double | excel_in, |
const double & | i_timezone | ||
) |
Set date from an Excel date.
excel_in | Excel date to set |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setFromSys | ( | ) |
Set internal gmt time from system time as well as system time zone.
void mio::Date::setMatlabDate | ( | const double | matlab_in, |
const double & | i_timezone | ||
) |
Set date from an Matlab date.
matlab_in | Matlab date to set |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setModifiedJulianDate | ( | const double & | julian_in, |
const double & | i_timezone | ||
) |
Set date from a modified julian date (MJD).
julian_in | julian date to set |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setRFC868Date | ( | const double & | julian_in, |
const double & | i_timezone | ||
) |
Set date from an RFC868 date (time since 1900-01-01T00:00 GMT, valid until 2036).
julian_in | julian date to set |
i_timezone | timezone as an offset to GMT (in hours, optional) |
void mio::Date::setTimeZone | ( | const double & | in_timezone | ) |
Set timezone and Daylight Saving Time flag.
in_timezone | timezone as an offset to GMT (in hours) |
void mio::Date::setUndef | ( | const bool & | flag = true | ) |
void mio::Date::setUnixDate | ( | const time_t & | in_time | ) |
Set date from a Unix date.
in_time | unix time (ie: as number of seconds since Unix Epoch, always UTC) |
const std::string mio::Date::toString | ( | ) | const |
const string mio::Date::toString | ( | const FORMATS & | type, |
const bool & | gmt = false |
||
) | const |
Return a nicely formated string.
type | select the formating to apply (see the definition of Date::FORMATS) |
gmt | convert returned value to GMT? (default: false) |
|
friend |
|
friend |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
minimum difference between two dates in days. 3600.025 is intentional to support high sampling rates
|
static |
|
static |
offset between julian date and Excel dates (note that excel invented some days...)
|
protected |
|
static |
offset between julian date and Matlab dates
|
static |
offset between julian date and modified julian date
|
static |
offset between julian date and RFC868 time (ref is 1900-01-01T00:00 GMT)
|
protected |
|
staticprotected |
|
protected |
|
static |
offset between julian date and Unix Epoch time