mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: create common QDateTime -> timestamp conversion function
In analogy to the timestamp -> QDateTime conversion, create a common function. 1) For symmetry with the opposite conversion. 2) To remove numerous inconsistencies. 3) To remove use of the deprecated QDateTime::toTime_t() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e33e420ef3
commit
8f80129bac
9 changed files with 19 additions and 13 deletions
|
@ -85,7 +85,7 @@ void DivePlannerPointsModel::setupStartTime()
|
|||
if (dive_table.nr) {
|
||||
struct dive *d = get_dive(dive_table.nr - 1);
|
||||
time_t ends = dive_endtime(d);
|
||||
time_t diff = ends - startTime.toTime_t();
|
||||
time_t diff = ends - dateTimeToTimestamp(startTime);
|
||||
if (diff > 0) {
|
||||
startTime = startTime.addSecs(diff + 3600);
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ void DivePlannerPointsModel::setSurfaceSegment(int duration)
|
|||
void DivePlannerPointsModel::setStartDate(const QDate &date)
|
||||
{
|
||||
startTime.setDate(date);
|
||||
diveplan.when = startTime.toTime_t();
|
||||
diveplan.when = dateTimeToTimestamp(startTime);
|
||||
displayed_dive.when = diveplan.when;
|
||||
emitDataChanged();
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ void DivePlannerPointsModel::setStartDate(const QDate &date)
|
|||
void DivePlannerPointsModel::setStartTime(const QTime &t)
|
||||
{
|
||||
startTime.setTime(t);
|
||||
diveplan.when = startTime.toTime_t();
|
||||
diveplan.when = dateTimeToTimestamp(startTime);
|
||||
displayed_dive.when = diveplan.when;
|
||||
emitDataChanged();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue