aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-07 21:55:04 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-07 22:08:04 -0800
commitc62baea03259aeb9b08aeb53be9a0fcac9a589ed (patch)
tree00fe968c7229510f939df954b80e5338fffbbc08 /subsurface-core
parent1eda61e1158de19a47acdfc5525f5f0df002052f (diff)
downloadsubsurface-c62baea03259aeb9b08aeb53be9a0fcac9a589ed.tar.gz
Correctly adjust time stamp of GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/gpslocation.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/subsurface-core/gpslocation.cpp b/subsurface-core/gpslocation.cpp
index cbcb6910b..40fb0e54e 100644
--- a/subsurface-core/gpslocation.cpp
+++ b/subsurface-core/gpslocation.cpp
@@ -119,7 +119,7 @@ QString GpsLocation::currentPosition()
void GpsLocation::newPosition(QGeoPositionInfo pos)
{
- time_t lastTime;
+ int64_t lastTime;
QGeoCoordinate lastCoord;
QString msg("received new position %1");
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
// time has passed or we moved at least the configured minimum distance
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) {
waitingForPosition = false;
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_lon").arg(nr), rint(pos.coordinate().longitude() * 1000000));
geoSettings->sync();