Bug#509828: gnome-panel: Clock applet may not update often enough with custom format
mjw at drexel.edu
Fri Dec 26 19:55:14 UTC 2008
When using a custom date format for the clock applet, the "Show seconds"
checkbox is disabled, but that checkbox actually has two effects - it
both controls whether seconds are displayed in some formats (12 hour, 24
hour, Internet time), and it controls whether the applet is updated once
every minute, or once every second. In the case of a custom format, the
checkbox is disabled and cannot be toggled, but the clock still updates
at a rate determined by the value that the "Show seconds" box had before
it was disabled.
Steps to reproduce:
1. Right click clock applet
2. Click "preferences"
3. Change "clock type" to "12 hour" and uncheck "show seconds"
4. Change "clock type" to "Unix time" and observe that updates happen
5. Change "clock type" to "Custom format" and type "%s" in the "Custom
format" box to display Unix time - observe that the panel does not
change each second as it ought to, but each minute instead.
6. Change "clock type" to "12 hour" and check "show seconds"
7. Change "clock type" to "Custom format" and note that the panel now
shows Unix time updating once per second.
In my opinion, the "Show seconds" button ought to not be considered for
a custom format. Alternatives include:
1. Always update after 1 second when using a custom format
This is the wrong way to do it, but it's simple and will fix the bug,
at the cost of waking up the process once per second.
2. Check the custom format for "%s", "%S", "%r", "%T", "%z", etc
Also not a great idea, since which formats contain a "seconds" value
isn't necessarily portable across platforms, and catching the format
modifiers attached to each of these would be even uglier.
3. When a custom format is used, remember the last label used for the
clock, update once per second, and see if the label ever doesn't
change for 3 updates in a row. If so, assume that it will only
change once per minute, and increase the timeout accordingly.
This way is a little tougher to implement, but seems the nicest - it
only requires a few extra bytes of memory (that can be freed when the
format is changed from custom), it does not cause the clock to update
more often than necessary once it settles down, and it still properly
handles updating the clock once per second if necessary. I'd be
happy to provide a patch if others agree that this solution is
More information about the pkg-gnome-maintainers