summaryrefslogtreecommitdiffstats
path: root/qt-gui.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-01 15:02:20 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-01 15:25:53 -0700
commite2271f50ad5b73306dc11c8bf2be46d768c9026e (patch)
tree59e308abe02a6f60f27dd8fa4c879f7d8bb52462 /qt-gui.cpp
parent13d922aef7f838c013f1d8eff7771d7b59cf0457 (diff)
downloadsubsurface-e2271f50ad5b73306dc11c8bf2be46d768c9026e.tar.gz
Fix time zone issues in 32bit builds
The bug is obvious, tracking it down wasn't. A simple thinko brought us time_t instead of timestamp_t - which doesn't matter on 64bit builds, but makes things fail in weird ways on 32bit builds - like our Windows binaries. In this case instead of checking today's date to detect the timezone offset we happened to be using a date in December 1969, so no dailight savings, so the times were off. Fixes #655 Fixes #667 See #670 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r--qt-gui.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 0f5342921..e337a5ddd 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -372,7 +372,7 @@ QString getSubsurfaceDataPath(QString folderToFind)
return QString("");
}
-int gettimezoneoffset(time_t when)
+int gettimezoneoffset(timestamp_t when)
{
QDateTime dt1, dt2;
if (when == 0)
@@ -408,14 +408,14 @@ int parseTemperatureToMkelvin(const QString &text)
QString get_dive_date_string(timestamp_t when)
{
QDateTime ts;
- ts.setMSecsSinceEpoch(when * 1000);
+ ts.setMSecsSinceEpoch(when * 1000L);
return loc.toString(ts.toUTC(), dateFormat + " " + timeFormat);
}
QString get_short_dive_date_string(timestamp_t when)
{
QDateTime ts;
- ts.setMSecsSinceEpoch(when * 1000);
+ ts.setMSecsSinceEpoch(when * 1000L);
return loc.toString(ts.toUTC(), shortDateFormat + " " + timeFormat);
}