48 static const int YEARS = 31557600;
50 static const int MONTHS = 60 * 60 * 24 * 30;
52 static const int WEEKS = 60 * 60 * 24 * 7;
54 static const int DAY = 60 * 60 * 24;
56 static const int HOUR = 60 * 60;
58 static const int MINUTE = 60;
85 QgsInterval(
double years,
double months,
double weeks,
double days,
double hours,
double minutes,
double seconds );
109 void setYears(
double years );
121 double months()
const;
134 void setMonths(
double months );
145 double weeks()
const;
158 void setWeeks(
double weeks );
182 void setDays(
double days );
193 double hours()
const;
206 void setHours(
double hours );
217 double minutes()
const;
230 void setMinutes(
double minutes );
249 void setSeconds(
double seconds );
299 if ( !mValid && !other.mValid )
302 return mOriginalUnit == other.mOriginalUnit && mOriginalDuration == other.mOriginalDuration;
303 else if ( mValid && other.mValid )
311 return !( *
this == other );
319 static QgsInterval fromString(
const QString &
string );
322 operator QVariant()
const
324 return QVariant::fromValue( *
this );
330 double mSeconds = 0.0;
336 double mOriginalDuration = 0.0;
A representation of the interval between two datetime values.
double originalDuration() const
Returns the original interval duration.
bool isValid() const
Returns true if the interval is valid.
void setValid(bool valid)
Sets whether the interval is valid.
QgsInterval()=default
Default constructor for QgsInterval.
bool operator==(QgsInterval other) const
double seconds() const
Returns the interval duration in seconds.
bool operator!=(QgsInterval other) const
QgsUnitTypes::TemporalUnit originalUnit() const
Returns the original interval temporal unit.
TemporalUnit
Temporal units.
@ TemporalUnknownUnit
Unknown time unit.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QDateTime CORE_EXPORT operator+(const QDateTime &start, const QgsInterval &interval)
Adds an interval to a datetime.
QgsInterval CORE_EXPORT operator-(const QDateTime &datetime1, const QDateTime &datetime2)
Returns the interval between two datetimes.
QDebug CORE_EXPORT operator<<(QDebug dbg, const QgsInterval &interval)
Debug string representation of interval.