Code

utils: Use singular in time_seconds_to_durationstr() if appropriate.
authorPatrick Hallen <patrick.hallen@rwth-aachen.de>
Wed, 18 Mar 2009 16:48:20 +0000 (17:48 +0100)
committerPatrick Hallen <patrick.hallen@rwth-aachen.de>
Sat, 28 Mar 2009 18:01:23 +0000 (19:01 +0100)
src/utils.c

index 32707eb48901ac164ee8d23e4e9fdde377a8c89d..da8fd60aa0527aebbf5594c3ff412bdd3bc09448 100644 (file)
@@ -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;