Fixed broken CPU speed on linux when /sys/ wasn't available
This commit is contained in:
parent
0c5869da38
commit
eacce05f3a
1 changed files with 3 additions and 4 deletions
5
neofetch
5
neofetch
|
@ -826,12 +826,11 @@ getcpu () {
|
||||||
read -r speed < \
|
read -r speed < \
|
||||||
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
|
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
|
||||||
|
|
||||||
|
speed=$((speed / 100000))
|
||||||
else
|
else
|
||||||
speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)
|
speed=$(awk -F ': |\\.' '/cpu MHz/ {printf $2; exit}' /proc/cpuinfo)
|
||||||
|
speed=$((speed / 100))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert mhz to ghz without bc
|
|
||||||
speed=$((speed / 100000))
|
|
||||||
speed=${speed:0:1}.${speed:1}
|
speed=${speed:0:1}.${speed:1}
|
||||||
|
|
||||||
cpu="$cpu @ ${speed}GHz"
|
cpu="$cpu @ ${speed}GHz"
|
||||||
|
|
Loading…
Reference in a new issue