mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly adjust time stamp of GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1eda61e115
commit
c62baea032
1 changed files with 6 additions and 3 deletions
|
@ -119,7 +119,7 @@ QString GpsLocation::currentPosition()
|
||||||
|
|
||||||
void GpsLocation::newPosition(QGeoPositionInfo pos)
|
void GpsLocation::newPosition(QGeoPositionInfo pos)
|
||||||
{
|
{
|
||||||
time_t lastTime;
|
int64_t lastTime;
|
||||||
QGeoCoordinate lastCoord;
|
QGeoCoordinate lastCoord;
|
||||||
QString msg("received new position %1");
|
QString msg("received new position %1");
|
||||||
status(qPrintable(msg.arg(pos.coordinate().toString())));
|
status(qPrintable(msg.arg(pos.coordinate().toString())));
|
||||||
|
@ -133,11 +133,14 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
|
||||||
// if we have no record stored or if at least the configured minimum
|
// 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
|
// time has passed or we moved at least the configured minimum distance
|
||||||
if (!nr || waitingForPosition ||
|
if (!nr || waitingForPosition ||
|
||||||
(time_t)pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
|
(int64_t)pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
|
||||||
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
|
||||||
waitingForPosition = false;
|
waitingForPosition = false;
|
||||||
geoSettings->setValue("count", nr + 1);
|
geoSettings->setValue("count", nr + 1);
|
||||||
geoSettings->setValue(QString("gpsFix%1_time").arg(nr), pos.timestamp().toTime_t());
|
|
||||||
|
int64_t when = pos.timestamp().toTime_t();
|
||||||
|
when += gettimezoneoffset(when);
|
||||||
|
geoSettings->setValue(QString("gpsFix%1_time").arg(nr), when);
|
||||||
geoSettings->setValue(QString("gpsFix%1_lat").arg(nr), rint(pos.coordinate().latitude() * 1000000));
|
geoSettings->setValue(QString("gpsFix%1_lat").arg(nr), rint(pos.coordinate().latitude() * 1000000));
|
||||||
geoSettings->setValue(QString("gpsFix%1_lon").arg(nr), rint(pos.coordinate().longitude() * 1000000));
|
geoSettings->setValue(QString("gpsFix%1_lon").arg(nr), rint(pos.coordinate().longitude() * 1000000));
|
||||||
geoSettings->sync();
|
geoSettings->sync();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue