From 33a98ae20f81f91271f079629682b886e5c74445 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 7 Aug 2022 11:24:15 +0200 Subject: [PATCH] Fixed Android 11 uptime See #158 --- pfetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pfetch b/pfetch index d47b878..ac6ec27 100755 --- a/pfetch +++ b/pfetch @@ -486,7 +486,13 @@ get_uptime() { # math. case $os in (Linux* | Minix* | SerenityOS*) - IFS=. read -r s _ < /proc/uptime + if ! [ -r /proc/uptime ] || [ "$PF_FORCEALTUPTIME" -eq 1 ]; then + boot=$(date -d"$(uptime -s)" +%s) + now=$(date +%s) + s=$((now - boot)) + else + IFS=. read -r s _ < /proc/uptime + fi ;; (Darwin* | *BSD* | DragonFly*)