clients/desktop-shell: Reset panel clock timer everytime
In case of the system time changed in between. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
parent
ce1705435f
commit
523a2b75f1
|
@ -425,12 +425,16 @@ panel_launcher_tablet_tool_button_handler(struct widget *widget,
|
||||||
panel_launcher_activate(launcher);
|
panel_launcher_activate(launcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int clock_timer_reset(struct panel_clock *clock);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clock_func(struct toytimer *tt)
|
clock_func(struct toytimer *tt)
|
||||||
{
|
{
|
||||||
struct panel_clock *clock = container_of(tt, struct panel_clock, timer);
|
struct panel_clock *clock = container_of(tt, struct panel_clock, timer);
|
||||||
|
|
||||||
widget_schedule_redraw(clock->widget);
|
widget_schedule_redraw(clock->widget);
|
||||||
|
|
||||||
|
clock_timer_reset(clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -481,7 +485,7 @@ clock_timer_reset(struct panel_clock *clock)
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
tm = localtime(&ts.tv_sec);
|
tm = localtime(&ts.tv_sec);
|
||||||
|
|
||||||
its.it_interval.tv_sec = clock->refresh_timer;
|
its.it_interval.tv_sec = 0;
|
||||||
its.it_interval.tv_nsec = 0;
|
its.it_interval.tv_nsec = 0;
|
||||||
its.it_value.tv_sec = clock->refresh_timer - tm->tm_sec % clock->refresh_timer;
|
its.it_value.tv_sec = clock->refresh_timer - tm->tm_sec % clock->refresh_timer;
|
||||||
its.it_value.tv_nsec = 10000000; /* 10 ms late to ensure the clock digit has actually changed */
|
its.it_value.tv_nsec = 10000000; /* 10 ms late to ensure the clock digit has actually changed */
|
||||||
|
|
Loading…
Reference in New Issue