diff options
author | Alexandros Frantzis <alexandros.frantzis@collabora.com> | 2017-11-16 18:21:01 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-11-27 11:42:07 +0200 |
commit | 409b01fd6dad591b42e4f43c37b4e8c833422968 (patch) | |
tree | c19994c1984197ec6f001b453faeffcde5069ffc /compositor | |
parent | 7d2abcf6c8e7bf0cb137febfa43936ba9877c465 (diff) | |
download | weston-409b01fd6dad591b42e4f43c37b4e8c833422968.tar.gz weston-409b01fd6dad591b42e4f43c37b4e8c833422968.tar.bz2 weston-409b01fd6dad591b42e4f43c37b4e8c833422968.zip |
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>
Diffstat (limited to 'compositor')
-rw-r--r-- | compositor/text-backend.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compositor/text-backend.c b/compositor/text-backend.c index 5f6b5d80..e10f9576 100644 --- a/compositor/text-backend.c +++ b/compositor/text-backend.c @@ -106,7 +106,7 @@ struct text_backend { struct wl_client *client; unsigned deathcount; - uint32_t deathstamp; + struct timespec deathstamp; } input_method; struct wl_listener client_listener; @@ -938,11 +938,14 @@ static void launch_input_method(struct text_backend *text_backend); static void respawn_input_method_process(struct text_backend *text_backend) { - uint32_t time; + struct timespec time; + int64_t tdiff; /* if input_method dies more than 5 times in 10 seconds, give up */ - time = weston_compositor_get_time(); - if (time - text_backend->input_method.deathstamp > 10000) { + weston_compositor_get_time(&time); + tdiff = timespec_sub_to_msec(&time, + &text_backend->input_method.deathstamp); + if (tdiff > 10000) { text_backend->input_method.deathstamp = time; text_backend->input_method.deathcount = 0; } |