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;
This class represents a duration.
bool operator==(const Duration &other) const
Returns true if this duration is equal to the other.
Duration & operator=(const Duration &duration)
Sets this duration equal to duration.
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...
Duration()
Constructs a duration of 0 seconds.
bool isDaily() const
Returns whether the duration is specified in terms of days rather than seconds.
int asDays() const
Returns the length of the duration in days.
Duration operator-() const
Returns the negative of this duration.
int value() const
Returns the length of the duration in seconds or days.
Type type() const
Returns the time units (seconds or days) used to specify the duration.
Duration & operator/=(int value)
Divides this duration by a value.
Duration & operator+=(const Duration &other)
Adds another duration to this one.
int asSeconds() const
Returns the length of the duration in seconds.
bool operator<(const Duration &other) const
Returns true if this duration is smaller than the other.
Type
The unit of time used to define the duration.
@ Seconds
duration is a number of seconds
@ Days
duration is a number of days
Duration & operator-=(const Duration &other)
Subtracts another duration from this one.
Duration & operator*=(int value)
Multiplies this duration by a value.
Namespace KCal is for global classes, objects and/or functions in libkcal.