Use sysconf(_SC_CLK_TCK) and G_GSIZE_MODIFIER
authorMikael Berthe <mikael@lilotux.net>
Thu, 11 Nov 2010 22:31:41 +0100
changeset 6 55944382d88b
parent 5 d8550798bb1d
child 7 6524d7d3061b
Use sysconf(_SC_CLK_TCK) and G_GSIZE_MODIFIER
uptime.c
--- a/uptime.c	Thu Nov 11 22:21:13 2010 +0100
+++ b/uptime.c	Thu Nov 11 22:31:41 2010 +0100
@@ -21,6 +21,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <mcabber/modules.h>
 #include <mcabber/logprint.h>
@@ -152,7 +153,10 @@
 		while (*u && isdigit (*u)) u++;
 		*u = '\0';
 		if (!sscanf (p, "%llu", &mstime)) {
-			scr_log_print (LPRINT_LOGNORM, "uptime: now at %u/%u, remaining string: %s.", p - line -> str, line -> len, p);
+			scr_log_print (LPRINT_LOGNORM, "uptime: now at "
+				"%" G_GSIZE_MODIFIER "u/%" G_GSIZE_MODIFIER "u, "
+				"remaining string: %s.",
+				p - line -> str, line -> len, p);
 			g_string_free (line, TRUE);
 			return "Malformed own start time.";
 		}
@@ -184,7 +188,7 @@
 
 		guint hz = settings_opt_get_int ("uptime_hz");
 		if (!hz)
-			hz = 100;
+			hz = sysconf(_SC_CLK_TCK);
 		starttime = kbtime + (mstime / hz);
 	} else
 		starttime = time (NULL);