5 #ifndef CMR_TIME_INCLUDED
6 #define CMR_TIME_INCLUDED
35 TimePeriod(
Long seconds,
long num_ms_or_um = 0L,
bool is_millisecond =
true);
44 TimePeriod(
long days,
long hours,
long minutes,
long seconds,
45 long num_ms_or_um = 0L,
bool is_millisecond =
true);
56 operator timeval()
const;
66 long to_hours()
const;
70 long to_minutes()
const;
74 long to_seconds()
const;
95 long microseconds()
const;
99 long milliseconds()
const;
103 Long to_microseconds()
const;
107 Long to_milliseconds()
const;
116 void time_period(
Long seconds,
long num_ms_or_um = 0L,
bool is_millisecond =
true);
127 void time_period(
long days,
long hours,
long minutes,
128 long seconds,
long num_ms_or_um = 0L,
bool is_millisecond =
true);
134 void time_period(
const timeval& time);
151 bool operator<=(
const TimePeriod& time)
const;
153 bool operator>=(
const TimePeriod& time)
const;
155 bool operator!=(
const TimePeriod& time)
const;
166 AString to_string_full_precision()
const;
200 static bool is_microsecond(
long microsecond);
203 void normalize_time_period();
276 TimeDate(
int year,
int month,
int day,
int hour,
int min,
277 int second = 0,
int num_ms_or_um = 0,
bool is_millisecond =
true);
292 TimeDate& operator=(
const tm& tm_struct);
301 void set_time_and_date(
int year,
int month,
int day,
int hour,
int min,
302 int second = 0,
int num_ms_or_um = 0,
bool is_millisecond =
true);
303 void set_time_and_date(
const tm& tm_struct,
usecond_t microsecond = 0);
304 void set_time_and_date(
const time_t seconds);
305 void set_time_and_date(
const TimePeriod& period);
311 int julian_day()
const;
315 void get_time_and_date(
int& year,
int& month,
int& day,
316 int& hour,
int& min,
int&
second,
317 int& num_ms_or_um,
bool is_millisecond =
true)
const;
321 int get_year()
const;
325 int get_month()
const;
333 int get_hour()
const;
337 int get_minute()
const;
341 int get_second()
const;
345 int get_millisecond()
const;
349 int get_microsecond()
const;
365 bool operator!=(
const TimeDate& time_and_date)
const;
367 bool operator<=(
const TimeDate& time_and_date)
const;
368 bool operator>(
const TimeDate& time_and_date)
const;
369 bool operator>=(
const TimeDate& time_and_date)
const;
375 int compare(
const TimeDate& time)
const;
447 return time_and_date_ == time_and_date.time_and_date_;
452 return time_and_date_ != time_and_date.time_and_date_;
457 return time_and_date_ < time_and_date.time_and_date_;
462 return time_and_date_ <= time_and_date.time_and_date_;
468 return time_and_date_ > time_and_date.time_and_date_;
473 return time_and_date_ >= time_and_date.time_and_date_;
479 return time_and_date + period;
const long min_millisecond
Definition: Time.h:217
const int minutes_in_hour
Definition: Time.h:219
const long max_julian_day
Definition: Time.h:423
bool operator>=(const TimeDate &time_and_date) const
Definition: Time.h:471
TimePeriod operator*(long value, const TimePeriod &time)
Definition: Time.cpp:456
TimeDate operator-(const TimePeriod &period) const
Definition: Time.h:438
unsigned short day_t
Definition: Time.h:233
long CMREXD write_xml(const AString &sIn, OBStream &o)
Definition: AString.cpp:27
const long microseconds_in_second
Definition: Time.h:212
unsigned short minute_t
Definition: Time.h:237
bool read(IBStream &str, int &num)
Definition: Time.cpp:200
const long min_julian_day
Definition: Time.h:422
const long max_millisecond
Definition: Time.h:216
unsigned long usecond_t
Definition: Time.h:239
const long min_microsecond
Definition: Time.h:215
unsigned short hour_t
Definition: Time.h:236
const int days_in_week
Definition: Time.h:223
char AChar
Definition: Type.h:65
const int days_in_year
Definition: Time.h:226
AString to_string(long number, int width=0, char pad= '0')
Definition: Time.cpp:1405
#define CMREXD
Definition: Compiler.h:22
bool operator!=(const TimeDate &time_and_date) const
Definition: Time.h:450
CMREXD const char * which_one_name(which_one which)
const long seconds_in_day
Definition: Time.h:222
bool operator==(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:148
which_one
Definition: Time.h:241
const int seconds_in_minute
Definition: Time.h:218
const long max_microsecond
Definition: Time.h:214
TimeDate operator+(const TimePeriod &period) const
Definition: Time.h:432
TimeDate operator+(const TimePeriod &period, const TimeDate &time_and_date)
Definition: Time.h:477
Definition: CommBuffer.h:28
const int months_in_year
Definition: Time.h:228
long CMREXD read_xml(AString &sOut, IBStream &i)
Definition: AString.cpp:65
unsigned short week_t
Definition: Time.h:230
bool operator<(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:155
const int days_in_leap_year
Definition: Time.h:227
CMREXD commore::OBStream & operator<<(commore::OBStream &stream, const commore::TimeDate &object)
Definition: Time.cpp:915
bool from_string(TimeDate &value, const char *text, bool utc)
Definition: Time.cpp:221
unsigned short second_t
Definition: Time.h:238
Definition: IOBStream.h:166
const int hours_in_day
Definition: Time.h:220
long long Long
Definition: Type.h:43
short year_t
Definition: Time.h:234
bool operator>(const TimeDate &time_and_date) const
Definition: Time.h:466
bool operator<=(const TimeDate &time_and_date) const
Definition: Time.h:460
bool operator==(const TimeDate &time_and_date) const
Definition: Time.h:445
const int seconds_in_hour
Definition: Time.h:221
Definition: IOBStream.h:29
bool CMREXD sleep(TimePeriod timeout)
Definition: Time.cpp:1054
unsigned short weekday_t
Definition: Time.h:231
unsigned short month_t
Definition: Time.h:232
const long seconds_in_week
Definition: Time.h:224
const long milliseconds_in_second
Definition: Time.h:213
bool operator<(const TimeDate &time_and_date) const
Definition: Time.h:455