diff src/util.c @ 9424:79c4acbac4cd

[gaim-migrate @ 10242] " gaim_str_seconds_to_string returns an empty string for lengths of time under 1 minute. This leads to some odd-looking tooltips for people who have just logged in, for example. This patch resolves this by providing a nice seconds count for times under 1 minute." --Alan Ford committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 29 Jun 2004 12:50:17 +0000
parents cf5b5b63228d
children dfee44a581a4
line wrap: on
line diff
--- a/src/util.c	Tue Jun 29 12:29:22 2004 +0000
+++ b/src/util.c	Tue Jun 29 12:50:17 2004 +0000
@@ -2384,6 +2384,15 @@
 	const char *prefix = "";
 	guint days, hrs, mins;
 
+	gstr = g_string_new("");
+
+	if (secs < 60)
+	{
+		g_string_append_printf(gstr, "%d %s", secs,
+							   ngettext("second", "seconds", secs));
+		return g_string_free(gstr, FALSE);
+	}
+
 	days = secs / (60 * 60 * 24);
 	secs = secs % (60 * 60 * 24);
 	hrs  = secs / (60 * 60);
@@ -2391,8 +2400,6 @@
 	mins = secs / 60;
 	secs = secs % 60;
 
-	gstr = g_string_new("");
-
 	if (days > 0)
 	{
 		g_string_append_printf(gstr, "%d %s", days,