10 void status_uptime(GlobalData *g)
13 char text[16] = { 0 };
18 int upts, uptm, upth, uptd;
24 stlen = fileRead(stline, sizeof(stline), "/proc/uptime");
26 s.color = "#FF0000"; // red
31 /* Cut first element */
32 for(i = 0; i < stlen; i++) {
33 if (stline[i] == ' ') {
39 // Split time into days, hours, mins, secs
41 uptd = upts / (24 * 60 * 60);
42 upts -= uptd * (24 * 60 * 60);
43 upth = upts / (60 * 60);
44 upts -= upth * (60 * 60);
49 textlen = snprintf(text, sizeof(text), "up: ");
51 textlen += snprintf(&text[textlen], sizeof(text) - textlen, "%dd ", uptd);
55 snprintf(&text[textlen], sizeof(text) - textlen,
70 line_append_item(g, &s);