desktop-shell:change expiration of minute and sec
Fixes: #400 the clock on upper right corner of screen for desktop shell is behind one minute when compared to output of date command, so change initial expiration it_value for minute and sec to remove the delay. Signed-off-by: Veeresh Kadasani <veeresh.kadasani@huawei.com>
This commit is contained in:
+10
-3
@@ -48,6 +48,7 @@
|
|||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include <libweston/zalloc.h>
|
#include <libweston/zalloc.h>
|
||||||
#include "shared/file-util.h"
|
#include "shared/file-util.h"
|
||||||
|
#include "shared/timespec-util.h"
|
||||||
|
|
||||||
#include "weston-desktop-shell-client-protocol.h"
|
#include "weston-desktop-shell-client-protocol.h"
|
||||||
|
|
||||||
@@ -421,13 +422,19 @@ static int
|
|||||||
clock_timer_reset(struct panel_clock *clock)
|
clock_timer_reset(struct panel_clock *clock)
|
||||||
{
|
{
|
||||||
struct itimerspec its;
|
struct itimerspec its;
|
||||||
|
struct timespec ts;
|
||||||
|
struct tm *tm;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
tm = localtime(&ts.tv_sec);
|
||||||
|
|
||||||
its.it_interval.tv_sec = clock->refresh_timer;
|
its.it_interval.tv_sec = clock->refresh_timer;
|
||||||
its.it_interval.tv_nsec = 0;
|
its.it_interval.tv_nsec = 0;
|
||||||
its.it_value.tv_sec = clock->refresh_timer;
|
its.it_value.tv_sec = clock->refresh_timer - tm->tm_sec % clock->refresh_timer;
|
||||||
its.it_value.tv_nsec = 0;
|
its.it_value.tv_nsec = 10000000; /* 10 ms late to ensure the clock digit has actually changed */
|
||||||
toytimer_arm(&clock->timer, &its);
|
timespec_add_nsec(&its.it_value, &its.it_value, -ts.tv_nsec);
|
||||||
|
|
||||||
|
toytimer_arm(&clock->timer, &its);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user