Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rather useful in this case could be an adaptive method. First, you update every 50ms until you circled in the moment when the second toggles. Then you can do sleep(1) again and save resources.

Alternatively, use time() to only sleep the remaining timespan until the next second.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: