summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-22 18:53:25 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-22 12:31:06 -0700
commit8f80129bac29227a03c35940af9d197ef0fa6398 (patch)
tree40cd682efb11880af5410aab700dcd9d8bacbe72 /desktop-widgets
parente33e420ef3e5139015504ef49215721e99850f2b (diff)
downloadsubsurface-8f80129bac29227a03c35940af9d197ef0fa6398.tar.gz
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/simplewidgets.cpp2
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index b6244c826..ba3dc67ee 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -279,7 +279,7 @@ void ShiftImageTimesDialog::dcDateTimeChanged(const QDateTime &newDateTime)
if (!dcImageEpoch)
return;
newtime.setTimeSpec(Qt::UTC);
- setOffset(newtime.toTime_t() - dcImageEpoch);
+ setOffset(dateTimeToTimestamp(newtime) - dcImageEpoch);
}
void ShiftImageTimesDialog::matchAllImagesToggled(bool state)
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 81c56a486..978b22692 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -598,7 +598,7 @@ void MainTab::on_depth_editingFinished()
// all dives are shifted by an offset.
static void shiftTime(QDateTime &dateTime)
{
- timestamp_t when = dateTime.toTime_t();
+ timestamp_t when = dateTimeToTimestamp(dateTime);
if (current_dive && current_dive->when != when) {
timestamp_t offset = when - current_dive->when;
Command::shiftTime(getDiveSelection(), (int)offset);