Skip to content
Permalink
Browse files

Updated QgsInterval setter methods to update original duration and un…

…it when they

are called.
  • Loading branch information
Samweli authored and nyalldawson committed Jan 6, 2021
1 parent bcbf6ff commit 1e7ea7948be1f7686d432c1db6b72c678e692262
Showing with 57 additions and 0 deletions.
  1. +57 −0 src/core/qgsinterval.cpp
@@ -207,6 +207,63 @@ void QgsInterval::setSeconds( double seconds )
mOriginalUnit = QgsUnitTypes::TemporalSeconds;
}

void QgsInterval::setYears( double years )
{
mSeconds = years * YEARS;
mValid = true;
mOriginalDuration = years;
mOriginalUnit = QgsUnitTypes::TemporalYears;
}

void QgsInterval::setMonths( double months )
{
mSeconds = months * MONTHS;
mValid = true;
mOriginalDuration = months;
mOriginalUnit = QgsUnitTypes::TemporalMonths;
}

void QgsInterval::setWeeks( double weeks )
{
mSeconds = weeks * WEEKS;
mValid = true;
mOriginalDuration = weeks;
mOriginalUnit = QgsUnitTypes::TemporalWeeks;
}

void QgsInterval::setDays( double days )
{
mSeconds = days * DAY;
mValid = true;
mOriginalDuration = days;
mOriginalUnit = QgsUnitTypes::TemporalDays;
}

void QgsInterval::setHours( double hours )
{
mSeconds = hours * HOUR;
mValid = true;
mOriginalDuration = hours;
mOriginalUnit = QgsUnitTypes::TemporalHours;
}


void QgsInterval::setMinutes( double minutes )
{
mSeconds = minutes * MINUTE;
mValid = true;
mOriginalDuration = minutes;
mOriginalUnit = QgsUnitTypes::TemporalMinutes;
}

void QgsInterval::setSeconds( double seconds )
{
mSeconds = seconds;
mValid = true;
mOriginalDuration = seconds;
mOriginalUnit = QgsUnitTypes::TemporalSeconds;
}

bool QgsInterval::operator==( QgsInterval other ) const
{
if ( !mValid && !other.mValid )

0 comments on commit 1e7ea79

Please sign in to comment.
You can’t perform that action at this time.