浏览代码

Fix uptime value in Solaris

matt 2 年之前
父节点
当前提交
624bd97045
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      neofetch

+ 4 - 2
neofetch

@@ -1446,8 +1446,10 @@ get_uptime() {
         ;;
         ;;
 
 
         Solaris)
         Solaris)
-            s=$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}')
-            s=${s/.*}
+            boot=$(kstat -p unix:0:system_misc:boot_time | awk '{print $2}')
+            now=$(date +%s)
+
+            s=$((now - boot))
         ;;
         ;;
 
 
         AIX|IRIX)
         AIX|IRIX)