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
|
|
@ -169,7 +169,7 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
|
|||
// if we are waiting for a position update or
|
||||
// if we have no record stored or if at least the configured minimum
|
||||
// time has passed or we moved at least the configured minimum distance
|
||||
int64_t delta = (int64_t)pos.timestamp().toTime_t() + gettimezoneoffset() - lastTime;
|
||||
int64_t delta = dateTimeToTimestamp(pos.timestamp()) + gettimezoneoffset() - lastTime;
|
||||
if (!nr || waitingForPosition || delta > prefs.time_threshold ||
|
||||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
||||
QString msg = QStringLiteral("received new position %1 after delta %2 threshold %3 (now %4 last %5)");
|
||||
|
|
@ -177,7 +177,7 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
|
|||
waitingForPosition = false;
|
||||
acquiredPosition();
|
||||
gpsTracker gt;
|
||||
gt.when = pos.timestamp().toTime_t();
|
||||
gt.when = dateTimeToTimestamp(pos.timestamp());
|
||||
gt.when += gettimezoneoffset(gt.when);
|
||||
gt.location = create_location(pos.coordinate().latitude(), pos.coordinate().longitude());
|
||||
addFixToStorage(gt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue