uptime: [haiku] Fix uptime
This commit is contained in:
parent
15153f78d7
commit
a0a7f3ec54
15
neofetch
15
neofetch
|
@ -1213,15 +1213,6 @@ get_kernel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_uptime() {
|
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.
|
# Get uptime in seconds.
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "Windows" | "MINIX")
|
"Linux" | "Windows" | "MINIX")
|
||||||
|
@ -1258,6 +1249,10 @@ get_uptime() {
|
||||||
h="${h#0}" t="${t#0}"
|
h="${h#0}" t="${t#0}"
|
||||||
seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))"
|
seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"Haiku")
|
||||||
|
seconds=$(($(system_time) / 1000000))
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
days="$((seconds / 60 / 60 / 24)) days"
|
days="$((seconds / 60 / 60 / 24)) days"
|
||||||
|
@ -1277,8 +1272,6 @@ get_uptime() {
|
||||||
uptime="${days:+$days, }${hours:+$hours, }${mins}"
|
uptime="${days:+$days, }${hours:+$hours, }${mins}"
|
||||||
uptime="${uptime%', '}"
|
uptime="${uptime%', '}"
|
||||||
uptime="${uptime:-${seconds} seconds}"
|
uptime="${uptime:-${seconds} seconds}"
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Make the output of uptime smaller.
|
# Make the output of uptime smaller.
|
||||||
case "$uptime_shorthand" in
|
case "$uptime_shorthand" in
|
||||||
|
|
Reference in New Issue