Improve time display for time update intervals other than 1 second
rsaarelm opened this issue · comments
I want to reproduce i3status' behavior where the time update interval is 5 seconds, and the displayed time always snaps to a five second multiple, ie. 12:30:05, 12:30:10, and so on. On i3status-rust, you can set the interval, but then the rounding will be random, you get 12:30:07, 12:30:12 etc. for 5 second interval.
Another problem with the current system is that if you have a time display that doesn't show the seconds and set the update interval to 60 seconds, the clock display will have a random error since the actual time can change at any time during the 60 second interval window and the visible clock won't update.
A way to accomplish this is to adjust clock component's phase at startup so that it's first update snaps to the :00 time of the next minute. Now if the interval is a divisor of 60, the clock will keep showing a clean sequence of 00, 05, 10, 15 or 00, 10, 20, 30. If the interval is 60, the clock will be updated at the exact time the actual time changes.