uptime: [haiku] Fix uptime

This commit is contained in:
Dylan Araps
2019-09-26 09:50:02 +03:00
parent 15153f78d7
commit a0a7f3ec54
+4 -11
View File
@@ -1213,15 +1213,6 @@ get_kernel() {
}
get_uptime() {
# Since Haiku's uptime cannot be fetched in seconds, a case outside
# the usual case is needed.
case "$os" in
"Haiku")
uptime="$(uptime -u)"
uptime="${uptime/up }"
;;
*)
# Get uptime in seconds.
case "$os" in
"Linux" | "Windows" | "MINIX")
@@ -1258,6 +1249,10 @@ get_uptime() {
h="${h#0}" t="${t#0}"
seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))"
;;
"Haiku")
seconds=$(($(system_time) / 1000000))
;;
esac
days="$((seconds / 60 / 60 / 24)) days"
@@ -1277,8 +1272,6 @@ get_uptime() {
uptime="${days:+$days, }${hours:+$hours, }${mins}"
uptime="${uptime%', '}"
uptime="${uptime:-${seconds} seconds}"
;;
esac
# Make the output of uptime smaller.
case "$uptime_shorthand" in