summaryrefslogtreecommitdiff
path: root/src/uptime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uptime.c')
-rw-r--r--src/uptime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/uptime.c b/src/uptime.c
index c9f1c8e..49161c9 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -21,11 +21,18 @@ void run_uptime_command(const char *command) {
pclose(p);
}
+#ifndef __NetBSD__
void display_days() {
run_uptime_command("uptime | awk '{print $3}' && echo \" days\"");
}
+#endif
void display_time() {
+#if defined(__NetBSD__)
+ run_uptime_command("uptime | awk '{print $3}' | sed 's/,//' | "
+ "sed 's/:/ hours, /' && echo \" mins\"");
+#else
run_uptime_command("uptime | awk '{print $5}' | sed 's/,//' | "
"sed 's/:/ hours, /' && echo \" mins\"");
+#endif
}