mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Pick the correct timezoneoffset for the day in question
Calculating the timezoneoffset for the current date really makes no sense whatsoever when displaying a time that isn't "now". Fixes #605 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bebcbfe92a
commit
b3e662a895
3 changed files with 9 additions and 5 deletions
10
qt-gui.cpp
10
qt-gui.cpp
|
@ -372,10 +372,14 @@ QString getSubsurfaceDataPath(QString folderToFind)
|
|||
return QString("");
|
||||
}
|
||||
|
||||
int gettimezoneoffset()
|
||||
int gettimezoneoffset(time_t when)
|
||||
{
|
||||
QDateTime dt1 = QDateTime::currentDateTime();
|
||||
QDateTime dt2 = dt1.toUTC();
|
||||
QDateTime dt1, dt2;
|
||||
if (when == 0)
|
||||
dt1 = QDateTime::currentDateTime();
|
||||
else
|
||||
dt1 = QDateTime::fromMSecsSinceEpoch(when * 1000);
|
||||
dt2 = dt1.toUTC();
|
||||
dt1.setTimeSpec(Qt::UTC);
|
||||
return dt2.secsTo(dt1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue