From: Guido Günther Date: Thu, 23 Jan 2020 08:20:00 +0000 (+0100) Subject: etnaviv: drm: Normalize nano seconds X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56f955e4850035d915a2a87e2ebea7fa66ab5e19;p=mesa.git etnaviv: drm: Normalize nano seconds Make sure the nano second part is less than one second. This matches what clock_settime expects and allows for more concise kernel interfaces. Signed-off-by: Guido Günther Reviewed-by: Jonathan Marek Reviewed-by: Christian Gmeiner Part-of: --- diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h index 93bd2d90985..054e6cc730e 100644 --- a/src/etnaviv/drm/etnaviv_priv.h +++ b/src/etnaviv/drm/etnaviv_priv.h @@ -208,6 +208,10 @@ static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns) clock_gettime(CLOCK_MONOTONIC, &t); tv->tv_sec = t.tv_sec + ns / NSEC_PER_SEC; tv->tv_nsec = t.tv_nsec + ns % NSEC_PER_SEC; + if (tv->tv_nsec >= NSEC_PER_SEC) { + tv->tv_nsec -= NSEC_PER_SEC; + tv->tv_sec++; + } } #if HAVE_VALGRIND