KCal Library
Go to the documentation of this file.
36 #include <kdatetime.h>
45 class KCal::Duration::Private
48 int seconds()
const {
return mDaily ? mDuration * 86400 : mDuration; }
62 if ( start.time() ==
end.time() && start.timeSpec() ==
end.timeSpec() ) {
63 d->mDuration = start.daysTo(
end );
66 d->mDuration = start.secsTo(
end );
75 KDateTime endSt(
end.toTimeSpec( start ) );
76 d->mDuration = start.daysTo( endSt );
79 if ( start < endSt ) {
80 if ( endSt.time() < start.time() ) {
84 if ( endSt.time() > start.time() ) {
91 d->mDuration = start.secsTo(
end );
99 d->mDuration = duration;
104 : d( new KCal::
Duration::Private( *duration.d ) )
116 if ( &duration ==
this ) {
124 Duration::operator bool()
const
131 if ( d->mDaily == other.d->mDaily ) {
133 return d->mDuration < other.d->mDuration;
135 return d->seconds() < other.d->seconds();
144 d->mDuration == other.d->mDuration &&
145 d->mDaily == other.d->mDaily;
150 if ( d->mDaily == other.d->mDaily ) {
151 d->mDuration += other.d->mDuration;
152 }
else if ( d->mDaily ) {
153 d->mDuration = d->mDuration * 86400 + other.d->mDuration;
156 d->mDuration += other.d->mDuration + 86400;
173 d->mDuration *=
value;
179 d->mDuration /=
value;
185 return d->mDaily ? start.addDays( d->mDuration )
186 : start.addSecs( d->mDuration );
206 return d->mDaily ? d->mDuration : d->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()
Destroys a duration.
Duration & operator-=(const Duration &other)
Subtracts another duration from this one.
KDateTime end(const KDateTime &start) const
Computes a duration end time by adding the number of seconds or days in the duration to the specified...
int asSeconds() const
Returns the length of the duration in seconds.
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
Represents a span of time measured in seconds or days.
Duration & operator+=(const Duration &other)
Adds another duration to this one.
int asDays() const
Returns the length of the duration in days.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jul 28 2020 00:00:00 by
doxygen 1.8.18 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.