mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 23:56:15 +00:00
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>
This commit is contained in:
parent
13d922aef7
commit
e2271f50ad
2 changed files with 4 additions and 4 deletions
|
@ -27,7 +27,7 @@ void set_default_dive_computer(const char *vendor, const char *product);
|
||||||
void set_default_dive_computer_device(const char *name);
|
void set_default_dive_computer_device(const char *name);
|
||||||
QString getSubsurfaceDataPath(QString folderToFind);
|
QString getSubsurfaceDataPath(QString folderToFind);
|
||||||
extern const QString get_dc_nickname(const char *model, uint32_t deviceid);
|
extern const QString get_dc_nickname(const char *model, uint32_t deviceid);
|
||||||
int gettimezoneoffset(time_t when = 0);
|
int gettimezoneoffset(timestamp_t when = 0);
|
||||||
int parseTemperatureToMkelvin(const QString &text);
|
int parseTemperatureToMkelvin(const QString &text);
|
||||||
QString get_dive_date_string(timestamp_t when);
|
QString get_dive_date_string(timestamp_t when);
|
||||||
QString get_short_dive_date_string(timestamp_t when);
|
QString get_short_dive_date_string(timestamp_t when);
|
||||||
|
|
|
@ -372,7 +372,7 @@ QString getSubsurfaceDataPath(QString folderToFind)
|
||||||
return QString("");
|
return QString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
int gettimezoneoffset(time_t when)
|
int gettimezoneoffset(timestamp_t when)
|
||||||
{
|
{
|
||||||
QDateTime dt1, dt2;
|
QDateTime dt1, dt2;
|
||||||
if (when == 0)
|
if (when == 0)
|
||||||
|
@ -408,14 +408,14 @@ int parseTemperatureToMkelvin(const QString &text)
|
||||||
QString get_dive_date_string(timestamp_t when)
|
QString get_dive_date_string(timestamp_t when)
|
||||||
{
|
{
|
||||||
QDateTime ts;
|
QDateTime ts;
|
||||||
ts.setMSecsSinceEpoch(when * 1000);
|
ts.setMSecsSinceEpoch(when * 1000L);
|
||||||
return loc.toString(ts.toUTC(), dateFormat + " " + timeFormat);
|
return loc.toString(ts.toUTC(), dateFormat + " " + timeFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString get_short_dive_date_string(timestamp_t when)
|
QString get_short_dive_date_string(timestamp_t when)
|
||||||
{
|
{
|
||||||
QDateTime ts;
|
QDateTime ts;
|
||||||
ts.setMSecsSinceEpoch(when * 1000);
|
ts.setMSecsSinceEpoch(when * 1000L);
|
||||||
return loc.toString(ts.toUTC(), shortDateFormat + " " + timeFormat);
|
return loc.toString(ts.toUTC(), shortDateFormat + " " + timeFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue