subsurface/core
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
..
subsurface-qt Adds Cylinder helper class for cylinder info access in grantlee templates 2016-08-10 15:00:33 -07:00
android.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
checkcloudconnection.cpp Allow the user to give longer cloud timeout on the command line 2016-07-23 12:54:30 +09:00
checkcloudconnection.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
cloudstorage.cpp Use preferences object to correctly store cloud status 2016-07-23 12:53:37 +09:00
cloudstorage.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
CMakeLists.txt Adds Cylinder helper class for cylinder info access in grantlee templates 2016-08-10 15:00:33 -07:00
cochran.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
cochran.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
color.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
color.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
compressibility.r Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputer.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputer.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputerthreads.cpp Fix broken Bluetooth support 2016-04-18 06:01:01 -07:00
configuredivecomputerthreads.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
datatrak.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
datatrak.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
deco.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
deco.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
device.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
device.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
devicedetails.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
devicedetails.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
display.h Only do 9 minute interval for min/max/avg 2016-04-20 15:55:51 -07:00
dive.c Properly pick cylinder use when merging dives 2016-07-21 20:00:04 +09:00
dive.h Add new helper for case insensitive string comparison 2016-07-24 09:53:24 +09:00
divecomputer.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divecomputer.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelist.c Fix logic for presaturation 2016-06-11 10:28:04 -07:00
divelist.h Add helper to find the dive closest to a given time 2016-04-14 09:42:10 -07:00
divelogexportlogic.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divelogexportlogic.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesite.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesite.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesite.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesitehelpers.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
divesitehelpers.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
equipment.c Make cylinder_nodata() take a const cylinder pointer 2016-04-04 22:37:18 -07:00
exif.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
exif.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
file.c Remove unused variable 2016-06-11 10:32:00 -07:00
file.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gas-model.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gaspressures.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gaspressures.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gettext.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gettextfromc.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
gettextfromc.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
git-access.c Support libgit2 api 0.24 2016-06-23 16:35:39 -07:00
git-access.h git storage: init local repository 2016-04-27 15:05:37 -07:00
gpslocation.cpp Unify handling of QDateTime time zone information 2016-08-10 15:04:39 -07:00
gpslocation.h GPS provider: change haveGPS status if GPS source returns error 2016-04-17 22:59:12 -07:00
helpers.h Remove unused and buggy get_cylinder_used_gas_string() function 2016-04-05 16:52:58 -07:00
imagedownloader.cpp Only attempt to download each picture once 2016-04-30 16:18:44 -07:00
imagedownloader.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
isocialnetworkintegration.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
isocialnetworkintegration.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
libdivecomputer.c Add support for SAMPLE_EVENT_STRING event type 2016-07-21 20:00:04 +09:00
libdivecomputer.h Fix broken Bluetooth support 2016-04-18 06:01:01 -07:00
linux.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
liquivision.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
load-git.c Grr. Fix. Typo. 2016-06-14 12:15:03 -07:00
macos.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
membuffer.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
membuffer.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
metrics.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
metrics.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
ostctools.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
parse-xml.c Only setpoint changes with non-zero SP indicate a CCR dive 2016-06-14 12:04:36 -07:00
planner.c Remove unnecessary DivePlannerPointsModel functions and variables 2016-07-23 10:54:51 +09:00
planner.h Have divedatapoint store cylinder id instead of gasmix 2016-07-09 12:07:25 -07:00
pluginmanager.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
pluginmanager.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
pref.h Allow the user to give longer cloud timeout on the command line 2016-07-23 12:54:30 +09:00
prefs-macros.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
profile.c Show SAC rate when using the ruler 2016-07-18 16:27:38 +09:00
profile.h Don't calculate the 9 minute average 2016-04-20 16:00:28 -07:00
qt-gui.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
qt-init.cpp Find bundled translations on iOS 2016-05-04 13:51:55 -07:00
qthelper.cpp Have divedatapoint store cylinder id instead of gasmix 2016-07-09 12:07:25 -07:00
qthelper.h Have divedatapoint store cylinder id instead of gasmix 2016-07-09 12:07:25 -07:00
qthelperfromc.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
qtserialbluetooth.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
save-git.c Add proper line ending for unit line in git save format 2016-07-21 20:00:04 +09:00
save-html.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
save-html.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
save-xml.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
serial_ftdi.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
sha1.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
sha1.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
statistics.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
statistics.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
strndup.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
strtod.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
subsurfacestartup.c Allow the user to give longer cloud timeout on the command line 2016-07-23 12:54:30 +09:00
subsurfacestartup.h Allow switching the user from the command line 2016-04-29 12:14:59 -07:00
subsurfacesysinfo.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
subsurfacesysinfo.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
taxonomy.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
taxonomy.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
time.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
uemis-downloader.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
uemis.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
uemis.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
units.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
version.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
version.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
webservice.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
windows.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
windowtitleupdate.cpp Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
windowtitleupdate.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
worldmap-options.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
worldmap-save.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
worldmap-save.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00