Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript on Timeclock screen locks CPU #287

Open
inghamn opened this issue Apr 19, 2022 · 1 comment
Open

Javascript on Timeclock screen locks CPU #287

inghamn opened this issue Apr 19, 2022 · 1 comment

Comments

@inghamn
Copy link
Member

inghamn commented Apr 19, 2022

On the Raspberry PI timeclocks, the webpage they load sends the CPU to 100% usage, all the time. The wastes electricty, and causes the Raspberry PI to run very hot.

The culprit is a 10ms timeout loop that is meant to update the time displayed on the webpage (every 10 milliseconds). If we don't need per-second accuracy displayed on the timeclock, we don't need this CPU consuming loop.

inghamn added a commit that referenced this issue Apr 19, 2022
Changed the timeout from 10ms to 1 second.  This greatly reduces the burden on the CPU of the Raspberry PIs.

Updates #287
@inghamn
Copy link
Member Author

inghamn commented Apr 19, 2022

We saved a ton of CPU by doing the clock updates only once a second, rather than every 10 milliseconds. Further improvements can be had by replacing the custom formatting code with Date().toLocaleString(). However, this would require some HTML markup changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant