subsurface/qt-models
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
..
cleanertablemodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
cleanertablemodel.h Planner: show new icon to indicate that last point can't be deleted 2015-09-17 15:27:49 -07:00
CMakeLists.txt Untangle Library Linkage 2016-01-08 08:04:04 -08:00
completionmodels.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
completionmodels.h Correctly removes the Location Completion Model 2015-07-01 19:21:50 -07:00
cylindermodel.cpp Remove unnecessary DivePlannerPointsModel functions and variables 2016-07-23 10:54:51 +09:00
cylindermodel.h Planner: update cylinder mixes and MND and MOD when prefs are changed 2016-07-09 12:08:48 -07:00
divecomputerextradatamodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divecomputerextradatamodel.h Move ExtraDataModel to qt-models 2015-05-29 14:11:26 -07:00
divecomputermodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divecomputermodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelistmodel.cpp DiveListModel: don't add the dives one at a time 2016-04-05 21:17:37 -07:00
divelistmodel.h DiveListModel: don't add the dives one at a time 2016-04-05 21:17:37 -07:00
divelocationmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelocationmodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divepicturemodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divepicturemodel.h Move ImageDownloader out of the desktop widgets 2015-11-06 11:30:11 -08:00
diveplannermodel.cpp Unify handling of QDateTime time zone information 2016-08-10 15:04:39 -07:00
diveplannermodel.h Remove another unused variable 2016-07-23 10:54:56 +09:00
diveplotdatamodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
diveplotdatamodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesitepicturesmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesitepicturesmodel.h Add DiveSitePicturesModel 2015-08-15 04:59:01 -07:00
divetripmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divetripmodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
filtermodels.cpp Fix fix for filters 2016-07-09 12:45:55 -07:00
filtermodels.h Move the models to its own folder 2015-05-29 14:07:54 -07:00
gpslistmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gpslistmodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
models.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
models.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
ssrfsortfilterproxymodel.cpp Fix recursive stack-overflow 2015-08-31 18:41:47 -07:00
ssrfsortfilterproxymodel.h Add a new model: SsrfFilterProxyModel 2015-08-31 18:41:14 -07:00
tankinfomodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
tankinfomodel.h Move Tankinfomodel to its own file 2015-05-29 14:10:30 -07:00
treemodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
treemodel.h Move TreeModel to qt-models 2015-05-29 14:12:06 -07:00
weightmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
weightmodel.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
weigthsysteminfomodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
weigthsysteminfomodel.h Typo on the header guard. oops. 2015-05-29 20:58:58 -07:00
yearlystatisticsmodel.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
yearlystatisticsmodel.h Move the YearlyStatisticsModel to qt-models 2015-05-29 14:12:48 -07:00