UI cosmetics
authorMikael Berthe <mikael@lilotux.net>
Sun, 14 Nov 2010 11:17:51 +0100
changeset 10 36e7f4269583
parent 9 c1f0277182a3
child 11 431de0cc8126
UI cosmetics
uptime.c
--- a/uptime.c	Sun Nov 14 11:02:15 2010 +0100
+++ b/uptime.c	Sun Nov 14 11:17:51 2010 +0100
@@ -1,5 +1,6 @@
 
 /* Copyright 2010 Myhailo Danylenko
+ * Copyright 2010 Mikael Berthe
  *
  * This file is part of mcabber-uptime
  *
@@ -111,20 +112,24 @@
 	hours   %= 24;
 
 	if (days)
-		g_string_append_printf (line, " %u days", days);
+		g_string_append_printf (line, " %u day%c", days,
+				days > 1 ? 's' : ' ');
 	if (hours)
-		g_string_append_printf (line, " %u hours", hours);
+		g_string_append_printf (line, " %u hour%c", hours,
+				hours > 1 ? 's' : ' ');
 	if (minutes)
-		g_string_append_printf (line, " %u minutes", minutes);
+		g_string_append_printf (line, " %u minute%c", minutes,
+				minutes > 1 ? 's' : ' ');
 	if (seconds)
-		g_string_append_printf (line, " %u seconds", seconds);
+		g_string_append_printf (line, " %u second%s", seconds,
+				seconds > 1 ? "s." : ".");
 
 	// Running since:
 	strftime(strstartdate, sizeof(strstartdate),
 			"%Y-%m-%d %H:%M", localtime(&starttime));
 
-	scr_log_print (LPRINT_NORMAL, "Uptime: %s.\n(Running since %s)",
-			line -> len ? line -> str : " 0 second",
+	scr_log_print (LPRINT_NORMAL, "Uptime: %s\n(Running since %s)",
+			line -> len ? line -> str : " 0 second.",
 			strstartdate);
 
 	g_string_free (line, TRUE);