2
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 or (at your option)
7
* version 3 of the License.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
QDateTime operator+(const QDateTime& dateTime, const TimeDelta& delta)
24
return dateTime.addSecs(delta.getHours() * 3600)
25
.addDays(delta.getDays())
26
.addMonths(delta.getMonths())
27
.addYears(delta.getYears());
30
TimeDelta TimeDelta::fromHours(int hours)
32
return {hours, 0, 0, 0};
35
TimeDelta TimeDelta::fromDays(int days)
37
return {0, days, 0, 0};
40
TimeDelta TimeDelta::fromMonths(int months)
42
return {0, 0, months, 0};
45
TimeDelta TimeDelta::fromYears(int years)
47
return {0, 0, 0, years};
58
TimeDelta::TimeDelta(int hours, int days, int months, int years)
66
int TimeDelta::getHours() const
71
int TimeDelta::getDays() const
76
int TimeDelta::getMonths() const
81
int TimeDelta::getYears() const