aboutsummaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Giorgio Marzano <marzano.giorgio@gmail.com>2015-10-11 15:37:28 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-18 17:37:49 -0700
commit44bdcffcd45904b621b37ffa6be0d7760173f492 (patch)
tree0cdb2ec1333d47c544735396e34b0e75451015ee /statistics.c
parent166d587197e9d1f227f603ed10de71bf06ccacb9 (diff)
downloadsubsurface-44bdcffcd45904b621b37ffa6be0d7760173f492.tar.gz
Display divetime according to dive mode and translation
Many time stats in maintab display also seconds in short freediving Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/statistics.c b/statistics.c
index 1b2a1a6d3..19fd350eb 100644
--- a/statistics.c
+++ b/statistics.c
@@ -207,7 +207,7 @@ void process_selected_dives(void)
stats_selection.selection_size = nr;
}
-char *get_time_string(int seconds, int maxdays)
+char *get_time_string_s(int seconds, int maxdays, bool freediving)
{
static char buf[80];
if (maxdays && seconds > 3600 * 24 * maxdays) {
@@ -216,10 +216,14 @@ char *get_time_string(int seconds, int maxdays)
int days = seconds / 3600 / 24;
int hours = (seconds - days * 3600 * 24) / 3600;
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
+ int secs = (seconds - days * 3600 * 24 - hours * 3600 - minutes*60);
if (days > 0)
snprintf(buf, sizeof(buf), translate("gettextFromC", "%dd %dh %dmin"), days, hours, minutes);
else
- snprintf(buf, sizeof(buf), translate("gettextFromC", "%dh %dmin"), hours, minutes);
+ if (freediving && seconds < 3600)
+ snprintf(buf, sizeof(buf), translate("gettextFromC", "%dmin %dsecs"), minutes, secs);
+ else
+ snprintf(buf, sizeof(buf), translate("gettextFromC", "%dh %dmin"), hours, minutes);
}
return buf;
}