33 if ( start.time() ==
end.time() ) {
34 mDuration = start.daysTo(
end );
37 mDuration = start.secsTo(
end );
45 mDuration = start.daysTo(
end );
49 if (
end.time() < start.time() ) {
53 if (
end.time() > start.time() ) {
60 mDuration = start.secsTo(
end );
73 mDuration = duration.mDuration;
74 mDaily = duration.mDaily;
80 if ( &duration ==
this ) {
84 mDuration = duration.mDuration;
85 mDaily = duration.mDaily;
90 Duration::operator bool()
const
97 if ( mDaily == other.mDaily ) {
99 return mDuration < other.mDuration;
101 return seconds() < other.seconds();
110 mDuration == other.mDuration &&
111 mDaily == other.mDaily;
117 if ( mDaily == other.mDaily ) {
118 mDuration += other.mDuration;
119 }
else if ( mDaily ) {
120 mDuration = mDuration * 86400 + other.mDuration;
123 mDuration += other.mDuration + 86400;
152 return mDaily ? start.addDays( mDuration )
153 : start.addSecs( mDuration );
172 return mDaily ? mDuration : mDuration / 86400;
bool isDaily() const
Returns whether the duration is specified in terms of days rather than seconds.
@ Seconds
duration is a number of seconds
Type
The unit of time used to define the duration.
Duration & operator*=(int value)
Multiplies this duration by a value.
bool operator<(const Duration &other) const
Returns true if this duration is smaller than the other.
Duration & operator=(const Duration &duration)
Sets this duration equal to duration.
bool operator==(const Duration &other) const
Returns true if this duration is equal to the other.
Duration & operator-=(const Duration &other)
Subtracts another duration from this one.
int asSeconds() const
Returns the length of the duration in seconds.
TQDateTime end(const TQDateTime &start) const
Computes a duration end time by adding the number of seconds or days in the duration to the specified...
Type type() const
Returns the time units (seconds or days) used to specify the duration.
Duration operator-() const
Returns the negative of this duration.
Duration()
Constructs a duration of 0 seconds.
Duration & operator/=(int value)
Divides this duration by a value.
int value() const
Returns the length of the duration in seconds or days.
@ Days
duration is a number of days
This class represents a duration.
Duration & operator+=(const Duration &other)
Adds another duration to this one.
int asDays() const
Returns the length of the duration in days.