| -R | --kernver | The kernel version |
| -u | --kernarch | The machine architecture |
| -k | --kernel | Combined kernel name and version |
-| -U | --uptime | The system uptime in minutes |
+| -U | --uptime | The system uptime |
| -w | --loadavg | The system average load for past 1, 5 and 15 minutes |
| -v | --voltage | The system voltage |
| -f | --fans | All system fans and their speed in RPM |
struct timespec tc = {0};
#pragma GCC diagnostic pop
+ uintmax_t now = 0;
if (-1 == (clock_gettime(CLOCK_BOOTTIME, &tc))) {
FUNC_FAILED("clock_gettime()");
}
- FILL_ARR(str1, FMT_UINT " %s",
- (uintmax_t)(tc.tv_sec / 60), "min");
+
+ now = (uintmax_t)tc.tv_sec;
+ if ((0 != (now / 86400))) { /* days */
+ FILL_ARR(str1, FMT_UINT "d " FMT_UINT "h " FMT_UINT "m",
+ (now / 86400),
+ ((now / 3600) % 24),
+ ((now / 60) % 60));
+ return;
+ }
+ if (59 < (now / 60)) { /* hours */
+ FILL_ARR(str1, FMT_UINT "h " FMT_UINT "m",
+ ((now / 3600) % 24),
+ ((now / 60) % 60));
+ return;
+ }
+
+ FILL_ARR(str1, FMT_UINT "m", ((now / 60) % 60));
}
{ .name = "kernver", .key = 'R', .doc = "The kernel version." },
{ .name = "kernarch", .key = 'u', .doc = "The machine architecture." },
{ .name = "kernel", .key = 'k', .doc = "Combined kernel name and version." },
- { .name = "uptime", .key = 'U', .doc = "The system uptime in minutes" },
+ { .name = "uptime", .key = 'U', .doc = "The system uptime" },
{ .name = "loadavg", .key = 'w', .doc = "The system average load for past 1, 5 and 15 minutes" },
{ .name = "voltage", .key = 'v', .doc = "The system voltage" },
{ .name = "fans", .key = 'f', .doc = "All system fans and their speed in RPM." },