49 static const int YEARS = 31557600;
51 static const int MONTHS = 60 * 60 * 24 * 30;
53 static const int WEEKS = 60 * 60 * 24 * 7;
55 static const int DAY = 60 * 60 * 24;
57 static const int HOUR = 60 * 60;
59 static const int MINUTE = 60;
92 QgsInterval(
double years,
double months,
double weeks,
double days,
double hours,
double minutes,
double seconds );
103 double years()
const;
116 void setYears(
double years );
128 double months()
const;
141 void setMonths(
double months );
152 double weeks()
const;
165 void setWeeks(
double weeks );
189 void setDays(
double days );
200 double hours()
const;
213 void setHours(
double hours );
224 double minutes()
const;
237 void setMinutes(
double minutes );
256 void setSeconds(
double seconds );
306 if ( !mValid && !other.mValid )
309 return mOriginalUnit == other.mOriginalUnit && mOriginalDuration == other.mOriginalDuration;
310 else if ( mValid && other.mValid )
318 return !( *
this == other );
326 static QgsInterval fromString(
const QString &
string );
329 operator QVariant()
const
331 return QVariant::fromValue( *
this );
337 double mSeconds = 0.0;
343 double mOriginalDuration = 0.0;
353#if QT_VERSION < QT_VERSION_CHECK(6, 4, 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-(QDate date1, QDate date2)
Returns the interval between two dates.
QDebug CORE_EXPORT operator<<(QDebug dbg, const QgsInterval &interval)
Debug string representation of interval.