From 141f6f12c0c1a1c12bba6bd34ec89acbb63133fe Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Wed, 4 Jan 2017 12:52:05 +0700 Subject: [PATCH] Uptime: Added support for AIX --- neofetch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/neofetch b/neofetch index cded7796..44456279 100755 --- a/neofetch +++ b/neofetch @@ -349,6 +349,14 @@ get_uptime() { seconds="$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}')" seconds="${seconds/.*}" ;; + + "AIX") + t="$(LC_ALL=POSIX ps -o etime= -p 1)" + d="0" h="0" + case "$t" in *"-"*) d="${t%%-*}"; t="${t#*-}";; esac + case "$t" in *":"*":"*) h="${t%%:*}"; t="${t#*:}";; esac + seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))" + ;; esac days="$((seconds / 60 / 60 / 24)) days"