subsurface/desktop-widgets
Robert C. Helling 2c715542fd Unify handling of QDateTime time zone information
Subsurface uses "local time" which in particular means we never
display time zone information to the user. The user (and our file
format) only sees times like 5pm or 17:00. A better name than
local time (which could mean "local at the dive spot) would
be "watch time", the time displayed by the diver's watch when
she entered the water.

Internally, we store times as time_t, seconds since Jan 1 1970 0:00
UTC. Our convention for conversion between 5pm and time_t as always
been to treat 5pm as if it were UTC.

Then confusion arose since Qt's QDateTime (which is tied to UI elements
like QTimeEdit and similar) is time zone aware and by default assumes
the system time zone. So when we set a QDateTime to 5pm and then later
convert it to time_t we have to take care about the difference between
UTC and the system time zone.

This patch unifies our solution to this problem: With it, we set all
QDateTime's time zone to UTC. This means we don't have to correct for
a time zone anymore when converting to time_t (note, however, the
signedness issue: Qt's idea of time_t is broken since it assumes it
to be unsigned thus not allowing for dates before 1970. Better use the
millisecont variants).

We only need to be careful about time zones when using the current time.
With this convention, when assigning the current time to a QDateTime, we
need to shift for the time zone since its value in UTC should actually be
the watch time of the user who is most likely used to the system time zone.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10 15:04:39 -07:00
..
css Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
marble Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
plugins Fix compilation with the new folder architecture 2016-04-05 12:32:36 -07:00
preferences Shrink the minimum size for preferences window 2016-07-28 04:54:51 -07:00
statistics Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
about.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
about.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
about.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
btdeviceselectiondialog.cpp btdeviceselectiondialog.cpp: fix unused variable 2015-11-07 22:22:41 +02:00
btdeviceselectiondialog.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
btdeviceselectiondialog.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
CMakeLists.txt Don't rely on CMAKE_AUTOUIC 2015-11-09 18:00:56 -08:00
configuredivecomputerdialog.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputerdialog.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputerdialog.ui configure OSTC/OSTC3: Add safety stop parameters 2016-01-22 06:50:22 -08:00
divecomponentselection.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
divecomputermanagementdialog.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divecomputermanagementdialog.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
divecomputermanagementdialog.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
divelistview.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelistview.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelogexportdialog.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelogexportdialog.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelogexportdialog.ui Shrink the size of export dialog 2016-07-28 04:54:10 -07:00
divelogimportdialog.cpp Parse txt formatted log files 2016-05-05 07:28:07 -07:00
divelogimportdialog.h Parse txt formatted log files 2016-05-05 07:28:07 -07:00
divelogimportdialog.ui Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divepicturewidget.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divepicturewidget.h Drag and Drop Images 2015-11-24 09:22:16 -08:00
diveplanner.cpp Planner: update cylinder mixes and MND and MOD when prefs are changed 2016-07-09 12:08:48 -07:00
diveplanner.h fixup: Don't confuse EAD and END 2016-05-21 07:03:55 -07:00
diveplanner.ui Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
diveshareexportdialog.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
diveshareexportdialog.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
diveshareexportdialog.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
downloadfromdivecomputer.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
downloadfromdivecomputer.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
downloadfromdivecomputer.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
filterwidget.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
globe.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
globe.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
groupedlineedit.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
groupedlineedit.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
kmessagewidget.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
kmessagewidget.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
listfilter.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
locationinformation.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
locationinformation.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
locationInformation.ui Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
maintab.cpp Fix Qt date interfaces for times before 1970 2016-04-29 09:07:41 -07:00
maintab.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
maintab.ui Fix include paths 2016-04-05 09:40:58 -07:00
mainwindow.cpp Add menu entry to remove the offline state 2016-07-30 13:29:06 -07:00
mainwindow.h Add menu entry to remove the offline state 2016-07-30 13:29:06 -07:00
mainwindow.ui Add menu entry to remove the offline state 2016-07-30 13:29:06 -07:00
modeldelegates.cpp Have divedatapoint store cylinder id instead of gasmix 2016-07-09 12:07:25 -07:00
modeldelegates.h modeldelegates: remove printing related delegates 2015-11-10 09:08:16 -08:00
notificationwidget.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
notificationwidget.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
plannerDetails.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
plannerSettings.ui fixup: Don't confuse EAD and END 2016-05-21 07:03:55 -07:00
printdialog.cpp Silence warnings in printdialog.cpp 2016-03-09 21:50:37 -08:00
printdialog.h Lazy Initialize QPrinter 2016-01-08 08:04:58 -08:00
printer.cpp Fix include paths 2016-04-05 09:40:58 -07:00
printer.h Move Profile widget out of desktop-widgets 2015-10-30 10:36:49 -07:00
printoptions.cpp Fix include paths 2016-04-05 09:40:58 -07:00
printoptions.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
printoptions.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
qtwaitingspinner.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
qtwaitingspinner.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
renumber.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
searchbar.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
setpoint.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
shiftimagetimes.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
shifttimes.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
simplewidgets.cpp Unify handling of QDateTime time zone information 2016-08-10 15:04:39 -07:00
simplewidgets.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
starwidget.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
starwidget.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
subsurfacewebservices.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
subsurfacewebservices.h Silence warnings in subsurfacewebservices.h 2016-03-09 21:50:26 -08:00
tableview.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
tableview.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
tableview.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
tagwidget.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
tagwidget.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
templateedit.cpp Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
templateedit.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
templateedit.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
templatelayout.cpp Fix include paths 2016-04-05 09:40:58 -07:00
templatelayout.h Fix include paths 2016-04-05 09:40:58 -07:00
undocommands.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
undocommands.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
updatemanager.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
updatemanager.h Cloud storage: modify protocol for checking cloud connectivity 2015-11-18 17:57:13 -08:00
urldialog.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
usermanual.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
usermanual.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
usersurvey.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
usersurvey.h Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
usersurvey.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00
webservices.ui Move qt-ui to desktop-widgets 2015-10-30 10:36:49 -07:00