summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-18 16:42:23 +0900
committer諏訪子 <suwako@076.moe>2024-06-18 16:42:23 +0900
commit656923fefbcef9e4071a477194e5706171ee5c18 (patch)
tree0bdcdcf56762fb9b85432a409ca18d97d87e8c75 /src
parent564e48b6fb6b53c7420849cf79c7c73f7788ed6c (diff)
NetBSD: 起動時間の修正
Diffstat (limited to 'src')
-rw-r--r--src/uptime.c7
-rw-r--r--src/uptime.h2
2 files changed, 9 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
}
diff --git a/src/uptime.h b/src/uptime.h
index 12ee668..74e0afe 100644
--- a/src/uptime.h
+++ b/src/uptime.h
@@ -1,7 +1,9 @@
#ifndef UPTIME_H
#define UPTIME_H
+#ifndef __NetBSD__
void display_days();
+#endif
void display_time();
#endif