From e6d884cf26161df65c2b4b8c39d6b4133760537b Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Thu, 11 May 2017 22:43:36 +0200 Subject: 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 --- core/statistics.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'core/statistics.c') 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) { -- cgit v1.2.3-70-g09d2