5 #include <libutl/Float.h> 73 set(days, hours, minutes, seconds);
82 return (
uint_t)(_n / (24 * 60 * 60));
89 double res = fmod(_n, 24 * 60 * 60);
98 double res = fmod(_n, 60 * 60);
136 return (
double)*
this + (double)rhs;
146 return (
double)*
this - (double)rhs;
153 return Duration(numDays * 24.0 * 60.0 * 60.0);
160 return Duration(numHours * 60.0 * 60.0);
Duration(uint_t days, uint_t hours, uint_t minutes, double seconds)
Constructor.
#define UTL_CLASS_DEFID
Default init() and deInit() (which are merely place-holders).
String toString(const FwdIt &begin, const FwdIt &end, const String &sep, bool key=false)
Obtain a string representation of a sequence (via Object::toString()).
uint_t minutes() const
Get the number of minutes.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
double seconds() const
Get the number of seconds.
uint_t hours() const
Get the number of hours.
Duration operator+(const Duration &rhs) const
Add the given duration to self and return the result.
Duration(const String &str)
Constructor.
static const Duration oneDay
Duration of one day.
unsigned long uint64_t
Unsigned 64-bit integer.
Duration(double seconds)
Constructor.
unsigned int uint_t
Unsigned integer.
uint_t days() const
Get the number of days.
static Duration seconds(uint64_t numSeconds)
Get duration in number of seconds.
static Duration days(double numDays)
Get duration in number of days.
static Duration hours(double numHours)
Get duration in number of hours.
static const Duration oneHour
Duration of one hour.
static Duration minutes(double numMinutes)
Get duration in number of minutes.
static const Duration oneMinute
Duration of one minute.
static const Duration oneHalfHour
Duration of half an hour.
static const Duration oneSecond
Duration of one second.
Duration operator-(const Duration &rhs) const
Subtract the given duration from self and return the result.