From ba6c57083177178c2c5bfda832bc2afe03cb249f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 2 Nov 2011 13:27:25 -0700 Subject: [PATCH 1/2] Surface interval is calculated from the END of previous dive Silly mistake Reported-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- statistics.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/statistics.c b/statistics.c index 845bc2a03..56b04f283 100644 --- a/statistics.c +++ b/statistics.c @@ -132,7 +132,8 @@ void show_dive_stats(struct dive *dive) set_label(info_stat_w.date, buf); set_label(info_stat_w.dive_time, "%d min", (dive->duration.seconds + 30) / 60); if (prev_dive) - set_label(info_stat_w.surf_intv, get_time_string(dive->when - prev_dive->when, 4)); + set_label(info_stat_w.surf_intv, + get_time_string(dive->when - (prev_dive->when + prev_dive->duration.seconds), 4)); else set_label(info_stat_w.surf_intv, "unknown"); value = get_depth_units(dive->maxdepth.mm, &decimals, &unit); From b9179aabd5429892ac5853b5f5fe993a007bd3ad Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 2 Nov 2011 13:30:49 -0700 Subject: [PATCH 2/2] Fix typo that broke min SAC calculation Actually more of a cut'n'paste-o Reported-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- statistics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statistics.c b/statistics.c index 56b04f283..351f2d150 100644 --- a/statistics.c +++ b/statistics.c @@ -83,7 +83,7 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive) dp->duration.seconds * dp->sac) / sac_time ; if (dp->sac > info_stat.max_sac.mliter) info_stat.max_sac.mliter = dp->sac; - if (info_stat.min_sac.mliter == 0 || dp->sac < info_stat.max_sac.mliter) + if (info_stat.min_sac.mliter == 0 || dp->sac < info_stat.min_sac.mliter) info_stat.min_sac.mliter = dp->sac; } }