all repos — tint2 @ 3f42584fbd909df75b7598560b5250ca0f4e8667

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Fix issue 401: Seconds not updating in second line of clock

git-svn-id: http://tint2.googlecode.com/svn/trunk@683 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
o9000 o9000
commit

3f42584fbd909df75b7598560b5250ca0f4e8667

parent

1272ce4bb96f6750ea4b2fe698357630c86a1d57

1 files changed, 13 insertions(+), 3 deletions(-)

jump to
M src/clock/clock.csrc/clock/clock.c

@@ -127,14 +127,24 @@ strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone));

return buf_tooltip; } +int time_format_needs_sec_ticks(char *time_format) +{ + if (!time_format) + return 0; + if (strchr(time_format, 'S') || strchr(time_format, 'T') || strchr(time_format, 'r')) + return 1; + return 0; +} void init_clock() { - if(time1_format && clock_timeout==0) { - if (strchr(time1_format, 'S') || strchr(time1_format, 'T') || strchr(time1_format, 'r')) + if (clock_timeout == 0) { + if (time_format_needs_sec_ticks(time1_format) || + time_format_needs_sec_ticks(time2_format)) { clock_timeout = add_timeout(10, 1000, update_clocks_sec, 0); - else + } else { clock_timeout = add_timeout(10, 1000, update_clocks_min, 0); + } } }