mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
QML UI: GPS location service - correctly calculate the delta
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b1037abdb7
commit
f298802b99
1 changed files with 5 additions and 5 deletions
|
@ -116,7 +116,7 @@ QString GpsLocation::currentPosition()
|
|||
|
||||
void GpsLocation::newPosition(QGeoPositionInfo pos)
|
||||
{
|
||||
int64_t lastTime;
|
||||
int64_t lastTime = 0;
|
||||
QGeoCoordinate lastCoord;
|
||||
int nr = m_trackers.count();
|
||||
if (nr) {
|
||||
|
@ -128,11 +128,11 @@ 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
|
||||
if (!nr || waitingForPosition ||
|
||||
(int64_t)pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
|
||||
int64_t delta = (int64_t)pos.timestamp().toTime_t() + gettimezoneoffset() - lastTime;
|
||||
if (!nr || waitingForPosition || delta > prefs.time_threshold ||
|
||||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
||||
QString msg("received new position %1");
|
||||
status(qPrintable(msg.arg(pos.coordinate().toString())));
|
||||
QString msg("received new position %1 after delta %2 threshold %3");
|
||||
status(qPrintable(msg.arg(pos.coordinate().toString()).arg(delta).arg(prefs.time_threshold)));
|
||||
waitingForPosition = false;
|
||||
gpsTracker gt;
|
||||
gt.when = pos.timestamp().toTime_t();
|
||||
|
|
Loading…
Add table
Reference in a new issue