QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
28 #include "qgis_core.h"
47 static const int YEARS = 31557600;
49 static const int MONTHS = 60 * 60 * 24 * 30;
51 static const int WEEKS = 60 * 60 * 24 * 7;
53 static const int DAY = 60 * 60 * 24;
55 static const int HOUR = 60 * 60;
57 static const int MINUTE = 60;
84 QgsInterval(
double years,
double months,
double weeks,
double days,
double hours,
double minutes,
double seconds );
90 double years()
const {
return mSeconds / YEARS; }
97 void setYears(
double years ) { mSeconds = years * YEARS; mValid =
true; }
103 double months()
const {
return mSeconds / MONTHS; }
110 void setMonths(
double months ) { mSeconds = months * MONTHS; mValid =
true; }
116 double weeks()
const {
return mSeconds / WEEKS; }
123 void setWeeks(
double weeks ) { mSeconds = weeks * WEEKS; mValid =
true; }
129 double days()
const {
return mSeconds / DAY; }
136 void setDays(
double days ) { mSeconds = days * DAY; mValid =
true; }
142 double hours()
const {
return mSeconds / HOUR; }
149 void setHours(
double hours ) { mSeconds = hours * HOUR; mValid =
true; }
155 double minutes()
const {
return mSeconds / MINUTE; }
162 void setMinutes(
double minutes ) { mSeconds = minutes * MINUTE; mValid =
true; }
175 void setSeconds(
double seconds ) { mSeconds = seconds; mValid =
true; }
197 static QgsInterval fromString(
const QString &
string );
200 operator QVariant()
const
202 return QVariant::fromValue( *
this );
208 double mSeconds = 0.0;
259 #endif // QGSINTERVAL_H
QDebug operator<<(QDebug dbg, const QgsInterval &interval)
Debug string representation of interval.
double seconds() const
Returns the interval duration in seconds.
void setYears(double years)
Sets the interval duration in years.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
double months() const
Returns the interval duration in months (based on a 30 day month).
TemporalUnit
Temporal units.
void setWeeks(double weeks)
Sets the interval duration in weeks.
void setHours(double hours)
Sets the interval duration in hours.
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
void setMonths(double months)
Sets the interval duration in months.
void setDays(double days)
Sets the interval duration in days.
double minutes() const
Returns the interval duration in minutes.
void setSeconds(double seconds)
Sets the interval duration in seconds.
double weeks() const
Returns the interval duration in weeks.
void setValid(bool valid)
Sets whether the interval is valid.
A representation of the interval between two datetime values.
double years() const
Returns the interval duration in years (based on an average year length)
double days() const
Returns the interval duration in days.
double hours() const
Returns the interval duration in hours.
QgsInterval CORE_EXPORT operator-(const QDateTime &datetime1, const QDateTime &datetime2)
Returns the interval between two datetimes.
bool isValid() const
Returns true if the interval is valid.
void setMinutes(double minutes)
Sets the interval duration in minutes.
QDateTime CORE_EXPORT operator+(const QDateTime &start, const QgsInterval &interval)
Adds an interval to a datetime.