89 if (hours > 23)
throw std::invalid_argument(
"Hours must be < 24");
97 if (minutes > 59)
throw std::invalid_argument(
"Hours must be < 60");
105 if (seconds > 60)
throw std::invalid_argument(
"Hours must be < 61");
113 if (milliseconds > 999)
throw std::invalid_argument(
"Hours must be < 1000");
131 if (ts.
negative()) os <<
"negative ";
133 os << ts.
days() <<
" days, " << +ts.
hours() <<
" hours, " << +ts.
minutes() <<
" minutes, "
bool operator>(const time_span &rhs) const
u8 seconds() const
Get number of seconds.
bool operator==(const time_span &rhs) const
bool operator<(const time_span &rhs) const
u64 total_hours() const
Converts the time_span to minutes.
std::ostream & operator<<(std::ostream &os, const date_time &ddt)
u32 days() const
Get number of days.
u16 milliseconds() const
Get number of milliseconds.
time_span & operator=(const time_span &rhs)
u64 total_milliseconds() const
Converts the time_span to milliseconds.
bool operator!=(const time_span &rhs) const
u64 total_minutes() const
Converts the time_span to minutes.
time_span(u32 days=0, u8 hours=0, u8 minutes=0, u8 seconds=0, u16 milliseconds=0, bool negative=false)
Construct time_span from given data.
int compare(const time_span &rhs) const
Compares this timespan with the given timespan.
bool operator<=(const time_span &rhs) const
bool negative() const
Indicates whether this time_span is negative.
bool operator>=(const time_span &rhs) const
u8 minutes() const
Get number of hours.
void set(u32 days=0, u8 hours=0, u8 minutes=0, u8 seconds=0, u16 milliseconds=0, bool negative=false)
Set the value of this time_span to given values.
u64 total_seconds() const
Converts the time_span to seconds.
u8 hours() const
Get number of hours.
bool zero() const
Indicates whether this time_span is zero.