round() is not a good function to use for formatting, as it produces inconsistent results by truncating trailing zeroes. printf() produces consistent results with an appropriate format.
The format string used here is equivalent to library/uptime.c in procps, producing output equivalent to /usr/bin/uptime on Debian.
Thank you for your contribution to the Pi-hole Community!
Please read the comments below to help us consider your Pull Request.
We are all volunteers and completing the process outlined will help us review your commits quicker.
Please make sure you
Base your code and PRs against the repositories developmental branch.
Sign Off all commits as we enforce the DCO for all contributions
Sign all your commits as they must have verified signatures
The system load shown in the web sidebar has inconsistent formatting, in that trailing zeroes are stripped. By long standing convention, Unix/Linux load average is presented as number rounded to 2 decimal places. Breaking from this convention can be viewed as visually ugly to veteran users; and potentially confusing for novices who may think something extra is being conveyed by the variation in formatting.
How does this PR accomplish the above?:
This moves the formatting being performed by round(), which is not intended to be used for visual formatting, to vprintf(). There is no need to round the numbers being passed around within the scripts, it is sufficient to use the automatic rounding provided by vprintf(). This change makes the load in the sidebar consistent with the output from /usr/bin/uptime on Debian (which is, in turn, consistent with the historical Unix uptime command).
Link documentation PRs if any are needed to support this PR:
By submitting this pull request, I confirm the following:
I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
I have commented my proposed changes within the code and I have tested my changes.
I am willing to help maintain this change if there are issues with it later.
round() is not a good function to use for formatting, as it produces inconsistent results by truncating trailing zeroes. printf() produces consistent results with an appropriate format.
The format string used here is equivalent to library/uptime.c in procps, producing output equivalent to /usr/bin/uptime on Debian.
Thank you for your contribution to the Pi-hole Community!
Please read the comments below to help us consider your Pull Request.
We are all volunteers and completing the process outlined will help us review your commits quicker.
Please make sure you
What does this PR aim to accomplish?:
The system load shown in the web sidebar has inconsistent formatting, in that trailing zeroes are stripped. By long standing convention, Unix/Linux load average is presented as number rounded to 2 decimal places. Breaking from this convention can be viewed as visually ugly to veteran users; and potentially confusing for novices who may think something extra is being conveyed by the variation in formatting.
How does this PR accomplish the above?:
This moves the formatting being performed by round(), which is not intended to be used for visual formatting, to vprintf(). There is no need to round the numbers being passed around within the scripts, it is sufficient to use the automatic rounding provided by vprintf(). This change makes the load in the sidebar consistent with the output from /usr/bin/uptime on Debian (which is, in turn, consistent with the historical Unix uptime command).
Link documentation PRs if any are needed to support this PR:
By submitting this pull request, I confirm the following:
git rebase
)