Which one of a set to show right now, on a timed rotation. More...
Go to the source code of this file.
Functions | |
| int | rotate_index (int year, int yday, int hour, int minute, int interval_min, int count) |
| Which of count is up now, advancing by one every interval_min minutes and wrapping round at the end. | |
Which one of a set to show right now, on a timed rotation.
Given the clock, how often to move on, and how many there are, this says which one is up. It works the choice out from the time itself rather than keeping a counter, so it survives a restart with no saved state and two watches set the same land on the same one.
It takes the clock already broken apart into its fields rather than a time_t or a struct tm, the way the rest of the core clock code does, so it needs no gmtime and stays off the SDK, which is what keeps it host-testable.