Unverified Commit 0e8965e9 authored by black's avatar black Committed by GitHub

Merge pull request #1239 from lightful/pr_uptime

support uptime from Android 9+
parents ad16b592 c86413c1
...@@ -1216,8 +1216,14 @@ get_uptime() { ...@@ -1216,8 +1216,14 @@ get_uptime() {
# Get uptime in seconds. # Get uptime in seconds.
case "$os" in case "$os" in
"Linux" | "Windows" | "MINIX") "Linux" | "Windows" | "MINIX")
seconds="$(< /proc/uptime)" if [[ -r /proc/uptime ]]; then
seconds="${seconds/.*}" seconds="$(< /proc/uptime)"
seconds="${seconds/.*}"
else
boot="$(date -d"$(uptime -s)" +%s)"
now="$(date +%s)"
seconds="$((now - boot))"
fi
;; ;;
"Mac OS X" | "iPhone OS" | "BSD" | "FreeMiNT") "Mac OS X" | "iPhone OS" | "BSD" | "FreeMiNT")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment