From: Patrick Hallen Date: Wed, 18 Mar 2009 16:48:20 +0000 (+0100) Subject: utils: Use singular in time_seconds_to_durationstr() if appropriate. X-Git-Tag: release-0.14~40^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9c1a6e3dc36067d83a4f93f82d5a841ec0eeec32;p=ncmpc.git utils: Use singular in time_seconds_to_durationstr() if appropriate. --- diff --git a/src/utils.c b/src/utils.c index 32707eb..da8fd60 100644 --- a/src/utils.c +++ b/src/utils.c @@ -133,8 +133,8 @@ time_seconds_to_durationstr(unsigned long time_seconds) duration = g_malloc(length); iter = duration; if (time_seconds / 31536000 > 0) { - if (time_seconds % 31536000 == 1) - bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 31536000, year); + if (time_seconds / 31536000 == 1) + bytes_written = g_snprintf(iter, length, "%d %s, ", 1, year); else bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 31536000, years); time_seconds %= 31536000; @@ -142,8 +142,8 @@ time_seconds_to_durationstr(unsigned long time_seconds) iter += bytes_written; } if (time_seconds / 604800 > 0) { - if (time_seconds % 604800 == 1) - bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 604800, week); + if (time_seconds / 604800 == 1) + bytes_written = g_snprintf(iter, length, "%d %s, ", 1, week); else bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 604800, weeks); time_seconds %= 604800; @@ -151,8 +151,8 @@ time_seconds_to_durationstr(unsigned long time_seconds) iter += bytes_written; } if (time_seconds / 86400 > 0) { - if (time_seconds % 86400 == 1) - bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 86400, day); + if (time_seconds / 86400 == 1) + bytes_written = g_snprintf(iter, length, "%d %s, ", 1, day); else bytes_written = g_snprintf(iter, length, "%lu %s, ", time_seconds / 86400, days); time_seconds %= 86400;