diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-05-11 22:43:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-05-26 15:50:52 -0700 |
commit | e6d884cf26161df65c2b4b8c39d6b4133760537b (patch) | |
tree | 2b9132e7d057c514c852a7cf7bed39fa67455a6f /core/statistics.c | |
parent | 53a8075bd8d7231f2bb483b9adca0fc60d4446f1 (diff) | |
download | subsurface-e6d884cf26161df65c2b4b8c39d6b4133760537b.tar.gz |
Creation of dive duration string and surface interval string
Update the function to create the dive duration string in a way that
it can be used also in info and stats tab and added some more flexibility.
Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min"
(with units and :) or "5min 35sec" (with units with space).
Add a new function to create the surface interval string.
Completely remove old function get_time_string() and get_time_string_s().
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core/statistics.c')
-rw-r--r-- | core/statistics.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/core/statistics.c b/core/statistics.c index 47e65ff72..18f247cb8 100644 --- a/core/statistics.c +++ b/core/statistics.c @@ -2,7 +2,6 @@ /* statistics.c * * core logic for the Info & Stats page - - * char *get_time_string(int seconds, int maxdays); * char *get_minutes(int seconds); * void process_all_dives(struct dive *dive, struct dive **prev_dive); * void get_selected_dives_text(char *buffer, int size); @@ -236,27 +235,6 @@ void process_selected_dives(void) stats_selection.selection_size = nr; } -char *get_time_string_s(int seconds, int maxdays, bool freediving) -{ - static char buf[80]; - if (maxdays && seconds > 3600 * 24 * maxdays) { - snprintf(buf, sizeof(buf), translate("gettextFromC", "more than %d days"), maxdays); - } else { - 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 - 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; -} - /* this gets called when at least two but not all dives are selected */ static void get_ranges(char *buffer, int size) { |