CPU: Fix inaccurate speed for processors below 1GHz

This commit is contained in:
Muhammad Herdiansyah 2017-07-13 18:42:44 +07:00
parent 347854b296
commit 63b26285fb

View file

@ -1014,18 +1014,13 @@ get_cpu() {
esac esac
if [[ "$speed" ]]; then if [[ "$speed" ]]; then
# Hide decimals if on. if (( speed < 1000 )); then
[[ "$speed_shorthand" == "on" ]] && \ cpu="$cpu @ ${speed}MHz $temp"
speed="$((speed / 100))"
# Fix for speeds under 1ghz.
if [[ -z "${speed:1}" ]]; then
speed="0.${speed}"
else else
[[ "$speed_shorthand" == "on" ]] && speed="$((speed / 100))"
speed="${speed:0:1}.${speed:1}" speed="${speed:0:1}.${speed:1}"
cpu="$cpu @ ${speed}GHz $temp"
fi fi
cpu="$cpu @ ${speed}GHz $temp"
fi fi
# Remove un-needed patterns from cpu output. # Remove un-needed patterns from cpu output.