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 <guido.gunther@puri.sm> Reviewed-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3534>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user