aboutsummaryrefslogtreecommitdiffstats
path: root/statistics.c
AgeCommit message (Collapse)Author
2012-06-30Fix a couple of possible divide-by-zero conditions in statisticsGravatar Linus Torvalds
Several people reported the average time problem, but there's another one lurking there too: if the dive duration is zero, you get bogus average depth information too (but because that one was a floating point divide, and by default they are unsignalling on x86, it didn't crash, it just resulted in bogus results). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-29Fix broken average SAC calculationGravatar Miika Turkia
old_sac_time was always 0 when calculating average air consumption. Thus the results were incorrect. Move the counter to stats_t structure as suggested by Linus. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-16Show statistics of selected divesGravatar Miika Turkia
If at least 2 dives are selected, show statistics of these dives on Overall Stats. Otherwise, show the statistics of all dives. Temperature is also added to the shown statistics. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Minor change to avoid adding statistics.h (moved the global variable and external function declaration to display-gtk.h). Another minor change to the text displayed for the "Stats" notebook page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-15Add statistics for longest, shortest, and shallowest diveGravatar Dirk Hohndel
I don't really like calling the shallowest dive "min depth", but all other texts that I could come up with that were reasonably short weren't any better... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-15Create separate single dive and total stats pagesGravatar Dirk Hohndel
No additional statistics added, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-15Separate out single dive statistics and total statisticsGravatar Dirk Hohndel
Right now this just changes the infrastructure - nothing outside of statistics.c is modified. This is simply in preparation to split out the single dive info and the total dive statistics in the future (as we are creating more info and more stats and they will overflow the screen area available - so this will turn into two notebook tabs). This commit does not change any functionality. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-31Define O2 permille for air in one spotGravatar Henrik Brautaset Aronsen
Having the O2 permille defined once is more readable. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
2011-12-09Use common helper function for the "no cylinder info" caseGravatar Linus Torvalds
Miika fixed the statistics code that didn't properly check for the "no cylinder info" case - this cleans it up and just uses the helper function in equipment.c. Rename the helper to be slightly better named while at it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09Show O2 per cent if given in cylinder infoGravatar Miika Turkia
O2 per cent from dive computer should be shown in Dive Info if one is given even without pressure information for the cylinder. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-09Fix up the statistics page use of pressure dataGravatar Linus Torvalds
The statistics page calculates air use separately, and also needs to be fixed up for the split of the pressures into sample-vs-start/end. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-07don't use strftime() due to locale issuesGravatar Lubomir I. Ivanov
Make statistics.c use snprintf() with weekday(), monthname() instead of strftime(). The mingw strftime() ends up having lots of problems at least on Windows unless you set the locale just right, so just avoid the problem by doing the simple function by hand. We already did that in other places anyway. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-04Don't test for liquid HeliumGravatar Dirk Hohndel
Simply accept temperatures that are above absolute zero. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04Clear O2/H2 field if there is no tank informationGravatar Dirk Hohndel
Found using the new test dives Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-04Don't display a water temperature of absolute 0 in info/stats pageGravatar Dirk Hohndel
Found using the new test dives Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Exclude obviously bogus SAC values from statistics calculationsGravatar Dirk Hohndel
Random cutoff is 2.8l/min (or about 0.1cuft/min) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Fix typo that broke min SAC calculationGravatar Dirk Hohndel
Actually more of a cut'n'paste-o Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Surface interval is calculated from the END of previous diveGravatar Dirk Hohndel
Silly mistake Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-02Add Info & Stats page to the notebookGravatar Dirk Hohndel
This provides the relevant information for the currently selected dive plus a bunch of statistics over all dives in the dive_table. The visual design has lots of room for improvement - right now the different fields change size - it might be nice to have a more modern look for the entries - the O2/He field is odd - for most divers the He value will always be 0, so maybe we should only show He if there's at least one dive that uses He? Also, we simply do a comma separated list of gases for all the tanks used Signed-off-by: Dirk Hohndel <dirk@hohndel.org>