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
checkcloudconnection.cpp Allow the user to give longer cloud timeout on the command line 2016-07-23 12:54:30 +09:00
checkcloudconnection.h
cloudstorage.cpp Use preferences object to correctly store cloud status 2016-07-23 12:53:37 +09:00
cloudstorage.h
CMakeLists.txt Adds Cylinder helper class for cylinder info access in grantlee templates 2016-08-10 15:00:33 -07:00
cochran.c
cochran.h
color.cpp
color.h
compressibility.r
configuredivecomputer.cpp
configuredivecomputer.h
configuredivecomputerthreads.cpp Fix broken Bluetooth support 2016-04-18 06:01:01 -07:00
configuredivecomputerthreads.h
datatrak.c
datatrak.h
deco.c
deco.h
device.c
device.h
devicedetails.cpp
devicedetails.h
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
divecomputer.h
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
divelogexportlogic.h
divesite.c
divesite.cpp
divesite.h
divesitehelpers.cpp
divesitehelpers.h
equipment.c Make cylinder_nodata() take a const cylinder pointer 2016-04-04 22:37:18 -07:00
exif.cpp
exif.h
file.c Remove unused variable 2016-06-11 10:32:00 -07:00
file.h
gas-model.c
gaspressures.c
gaspressures.h
gettext.h
gettextfromc.cpp
gettextfromc.h
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
isocialnetworkintegration.cpp
isocialnetworkintegration.h
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
liquivision.c
load-git.c Grr. Fix. Typo. 2016-06-14 12:15:03 -07:00
macos.c
membuffer.c
membuffer.h
metrics.cpp
metrics.h
ostctools.c
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
pluginmanager.h
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
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
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
qtserialbluetooth.cpp
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
save-xml.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
serial_ftdi.c
sha1.c
sha1.h
statistics.c Extend time parsing to before 1970 2016-04-29 09:07:17 -07:00
statistics.h
strndup.h
strtod.c
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
subsurfacesysinfo.h
taxonomy.c
taxonomy.h
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
uemis.h
units.h
version.c
version.h
webservice.h
windows.c
windowtitleupdate.cpp
windowtitleupdate.h
worldmap-options.h
worldmap-save.c
worldmap-save.h