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;
154 bool operator==(
const TimePeriod& time)
const;
155 bool operator!=(
const TimePeriod& time)
const;
166 AString to_string_full_precision()
const;
171 bool from_string(
const AChar* s);
183 long write_xml(
OBStream& stream)
const;
200 static bool is_microsecond(
long microsecond);
203 void normalize_time_period();
212 const long microseconds_in_second = 1000000L;
213 const long milliseconds_in_second = 1000L;
214 const long max_microsecond = 999999;
215 const long min_microsecond = 0;
216 const long max_millisecond = 999;
217 const long min_millisecond = 0;
218 const int seconds_in_minute = 60;
219 const int minutes_in_hour = 60;
220 const int hours_in_day = 24;
221 const int seconds_in_hour = 3600;
222 const long seconds_in_day = 86400;
223 const int days_in_week = 7;
224 const long seconds_in_week = 604800;
226 const int days_in_year = 365;
227 const int days_in_leap_year = 366;
228 const int months_in_year = 12;
230 typedef unsigned short week_t;
231 typedef unsigned short weekday_t;
232 typedef unsigned short month_t;
233 typedef unsigned short day_t;
234 typedef short year_t;
236 typedef unsigned short hour_t;
237 typedef unsigned short minute_t;
238 typedef unsigned short second_t;
239 typedef unsigned long usecond_t;
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);
283 TimeDate(
const tm& tm_struct, usecond_t microsecond = 0);
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;
364 bool operator==(
const TimeDate& time_and_date)
const;
365 bool operator!=(
const TimeDate& time_and_date)
const;
366 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;
380 AString to_string(
const AChar* format = 0)
const;
422 const long min_julian_day = 38L;
423 const long max_julian_day = 13688960L;
445 inline bool TimeDate::operator==(
const TimeDate& time_and_date)
const
447 return time_and_date_ == time_and_date.time_and_date_;
450 inline bool TimeDate::operator!=(
const TimeDate& time_and_date)
const
452 return time_and_date_ != time_and_date.time_and_date_;
455 inline bool TimeDate::operator<(
const TimeDate& time_and_date)
const
457 return time_and_date_ < time_and_date.time_and_date_;
460 inline bool TimeDate::operator<=(
const TimeDate& time_and_date)
const
462 return time_and_date_ <= time_and_date.time_and_date_;
466 inline bool TimeDate::operator>(
const TimeDate& time_and_date)
const
468 return time_and_date_ > time_and_date.time_and_date_;
471 inline bool TimeDate::operator>=(
const TimeDate& time_and_date)
const
473 return time_and_date_ >= time_and_date.time_and_date_;
477 inline TimeDate operator+(
const TimePeriod& period,
const TimeDate& time_and_date)
479 return time_and_date + period;
CMREXD const char * which_one_name(which_one which)
TimeDate operator+(const TimePeriod &period) const
Definition: Time.h:432
Definition: CommBuffer.h:28
Definition: IOBStream.h:166
Definition: IOBStream.h:29
bool CMREXD sleep(TimePeriod timeout)