21 #ifndef ASAP_DURATION_H 22 #define ASAP_DURATION_H 24 #include "constants.h" 27 template<u
int64_t convert = 1>
32 explicit operator double()
const;
41 std::string
str()
const;
duration< SECONDS_IN_HOUR > hours
A duration specified in hours.
duration(double v=0)
Constructs a duration with the value set to v.
duration< 1 > seconds
A duration specified in seconds.
duration< SECONDS_IN_MINUTE > minutes
A duration specified in minutes.
duration< SECONDS_IN_DAY > days
A duration specified in days.
duration< convert > operator-()
Changes the sign of a duration.
duration< SECONDS_IN_YEAR > years
A duration specified in years.
duration< convert > & operator+=(const duration< convert2 > &other)
Adds another duration to this duration, converting to this convertion factor (e.g, 1_day + 1_week == 1_day + 7_days)
duration< convert > & operator=(double v)
Sets the internal value to v.
duration< convert > & operator-=(const duration< convert2 > &other)
Subtracts another duration from this duration, converting to this convertion factor (e...
duration< SECONDS_IN_WEEK > weeks
A duration specified in weeks (7 days)
duration< SECONDS_IN_MONTH > months
A duration specified in months (30 days)
The asap::duration class exposes methods to create, manipulate and print durations.
double operator*() const
the same as asap::duration::operator double()
std::string str() const
Pretty print this duration, breaking down all the units (e.g: std::cout << 10_days would print 1 week...