The Qt model sorting for the dive date was using a unsigned number,
which doesn't work for dates before 1970.
Also, the dive date parsing got the year 1900 wrong. Not that we really
care, because other parts of date handling will screw up with any date
before the year 1904. So if you claim to be diving before 1904, you get
basically random behavior.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Use the function in every place instead of once using it and once copying the code again.
No functional change.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
The test for the dive being a planned dive was completely bogus:
- it should use "same_string()" which correctly checks for NULL
- the string it checks for is obviously spelled wrong anyway.
Reported-by: Alessandro Volpi <volpial@gmail.com>
Fixes: a031dbbbd ("When merging planned dives keep all cylinders")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The limits set in diveplanner.ui is intended for the unit set there,
meters. If we move between units we need to update the limits to.
This fixes#201
Signed-off-by: Anton Lundin <glance@acc.umu.se>
In the beginning of the diveplan, divedatapoints of zero
duration indicate available gases with the depth giving
the suggested switch depth. Zero-duration datapoints in
the middle of the dive do not have this meaning and should
thus be ignored when composing the gaslist.
The tests should have these gas defining segments in the beginning.
This fixes a problem when replanning a dive that would change
to random gases during deco.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
There were 1 or 2 hour differences between real dive time and the
imported time because of the time zones and energy saving in some locales.
Using timegm() ensures us UTC times instead of localized times.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Can't remember what I was thinking when wrote that crappy thing. A
simple sscanf call will do the job, and a sanity check, off course.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Libmdbº:xturns localized strings while parsing the data bases. This is
bad for time calculations as we may end with different strings formats
(e.g. en_US vs almost the rest of the world). Solution is simple: set a
fixed locale and parse only this format.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This resets the maximum crushing pressures and the maximal
ambient pressure between repetitive dives to prevent anomalies
that a dive produces a shorter deco when following another one
than without.
Reported-by: sfuchs@gmx.de
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Because `[ "$foo" != "" ] is equivalent to `[ "$foo" ]'
in all POSIX shells.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't quote if you don't have to. Spend those cpu cycles on doing
something more useful, instead.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The `which' command is a fork and possible not standard in various
distributions, or builtin in certain (odd)? shells, like `zsh'.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes some further updates to the new cylinder merging code:
- avoid re-using the cylinder if the usage type (OC/diluent/O2) is
different between the two dives, even if the gasmix might be the
same.
- avoid re-using a cylinder if the user has manually added pressure
data for it (and the pressures don't match)
- when deciding to reuse a cylinder, make sure that we merge as much of
the type information as makes sense.
This will potentially result in more cylinders that might need manual
cleanup, but at least we won't be throwing out user data. And in most
cases where merging happens, none of this is an issue (because the data
comes fresh from a dive computer, and won't have been manually edited to
trigger the new rules).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The old cylinder merging code depended on the preferred dive having all
the cylinders, and the newly merged dive was just forced to pick from
that existing set of cylinders.
That worked ok if you have a "main" dive computer that you have all the
gases programmed for, and you download that first, and then you download
any secondary data later.
But it completely messed up if the second dive computer had gases that
the first one didn't know about, and just basically ended up doing
random things.
This rewrites the whole thing to actually try to create a union of the
two sets of cylinders when merging, with sane matching so that if the
cylinders match you won't get duplicates.
Miika Turkia hit this when he only used one gas, but had several gases
defined in his OSTC that he downloaded after his Vyper (with had just
the single gas defined).
This should fix that case (at least it does for my xml merging test-case
that showed the same problem after some munging).
Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
In the previous code, there was a mistake in how cwd in travis works.
This solves that by just using make -C instead.
The only issue is that the tests currently fail.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't understand why the SeaBear tests fail... of course commenting
out failing tests is exactly the wrong thing to do. But I'll open an
issue on github instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reworks build.sh for proper argument parsing and variable quoting.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the Qt installer, there is a MaintenanceTool which can upgrade your
install, so don't install in a "versioned" directory, just install in a
plain Qt-directory.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>