i3 / i3status

Generates status bar to use with i3bar, dzen2 or xmobar
BSD 3-Clause "New" or "Revised" License
607 stars 254 forks source link

Feature Proposal: adjusting time according to refresh interval #434

Open cherti opened 4 years ago

cherti commented 4 years ago

Currently, i3status has a refresh interval and all widgets are updated according to this interval.

Assume, for the sake of argument, we use a tztime widget in the form hh:mm, showing hours and minutes of the current time and an interval time of 60s. In this configuration, the clock is behind the actual time for a certain amount of time (varying from 1s to 59s, depending on how i3status' refresh coincides with the actual minute turnover).

For some people it is preferrable to have the tztime widget advance the clock instead of lagging behind.

This could be implemented in two ways: 1) introduce an optional bool-flag in tzdata and correct the time accordingly by the global interval value. 2) introduce an optional correction value to tzdata by which the clocktime can be adjusted.

Would either of these options be merged upstream?

Flying-Toast commented 2 weeks ago

I'd like to send a PR for this - is it likely to be a feature that would be accepted?

@cherti could you elaborate on how the two implentations you outlined would work? I'm unable to understand them.

cherti commented 2 weeks ago

@Flying-Toast tzdata is the variable holding the time info that is displayed, somewhere in i3status (iirc, been a while since I looked).

  1. you have a bool flag on i3status and just a standardized implementation of how tzdata is corrected, such as adding half the refresh interval so on average the display time error is minimized, or adding the full interval data so that i3status is one refresh ahead of the actual time while reality catches up.
  2. have a flag that lets the user adjust how much correction is desired, defaulting to zero. Then the user can decide whether they want a full interval ahead, half an interval, nothing or something else funky.