libweston: Use struct timespec for compositor time
Change weston_compositor_get_time to return the current compositor time as a struct timespec. Also, use clock_gettime (with CLOCK_REALTIME) to get the time, since it's equivalent to the currently used gettimeofday call, but returns the data directly in a struct timespec. This commit is part of a larger effort to transition the Weston codebase to struct timespec. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
7d2abcf6c8
commit
409b01fd6d
@@ -4209,11 +4209,11 @@ static void launch_desktop_shell_process(void *data);
|
||||
static void
|
||||
respawn_desktop_shell_process(struct desktop_shell *shell)
|
||||
{
|
||||
uint32_t time;
|
||||
struct timespec time;
|
||||
|
||||
/* if desktop-shell dies more than 5 times in 30 seconds, give up */
|
||||
time = weston_compositor_get_time();
|
||||
if (time - shell->child.deathstamp > 30000) {
|
||||
weston_compositor_get_time(&time);
|
||||
if (timespec_sub_to_msec(&time, &shell->child.deathstamp) > 30000) {
|
||||
shell->child.deathstamp = time;
|
||||
shell->child.deathcount = 0;
|
||||
}
|
||||
@@ -5043,7 +5043,7 @@ wet_shell_init(struct weston_compositor *ec,
|
||||
shell, bind_desktop_shell) == NULL)
|
||||
return -1;
|
||||
|
||||
shell->child.deathstamp = weston_compositor_get_time();
|
||||
weston_compositor_get_time(&shell->child.deathstamp);
|
||||
|
||||
shell->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP;
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ struct desktop_shell {
|
||||
struct wl_listener client_destroy_listener;
|
||||
|
||||
unsigned deathcount;
|
||||
uint32_t deathstamp;
|
||||
struct timespec deathstamp;
|
||||
} child;
|
||||
|
||||
bool locked;
|
||||
|
||||
Reference in New Issue
Block a user