Преглед на файлове

- core_uptime returns the uptime as an int (previosuly it used a float)
If someone is really concerned that his ser uptime will wrap arround after
136 years I might be persuaded to change it back :-)

Andrei Pelinescu-Onciul преди 19 години
родител
ревизия
a74b76d852
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      core_cmd.c

+ 5 - 1
core_cmd.c

@@ -163,7 +163,11 @@ static void core_uptime(rpc_t* rpc, void* c)
 	if (rpc->add(c, "{", &s) < 0) return;
 	rpc->struct_add(s, "s", "now", ctime(&now));
 	rpc->struct_add(s, "s", "up_since", up_since_ctime);
-	rpc->struct_add(s, "f", "uptime", difftime(now, up_since));
+	/* no need for a float here (unless you're concerned that your uptime)
+	rpc->struct_add(s, "f", "uptime",  difftime(now, up_since));
+	*/
+	/* on posix system we can substract time_t directly */
+	rpc->struct_add(s, "d", "uptime",  (int)(now-up_since));
 }