shared: Add timespec_from_proto helper function
Add helper function to convert tv_sec_hi, tv_sec_lo, tv_nsec triplets, used for sending high-resolution timestamp data over the wayland protocol, to struct timespec values. Replace existing conversion code with the helper function. 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
c83fdaa555
commit
787fa611de
@@ -39,6 +39,7 @@
|
||||
#include <wayland-client.h>
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "shared/timespec-util.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
@@ -383,14 +384,6 @@ timespec_to_ms(const struct timespec *ts)
|
||||
return (uint32_t)ts->tv_sec * 1000 + ts->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
static void
|
||||
timespec_from_proto(struct timespec *tm, uint32_t tv_sec_hi,
|
||||
uint32_t tv_sec_lo, uint32_t tv_nsec)
|
||||
{
|
||||
tm->tv_sec = ((uint64_t)tv_sec_hi << 32) + tv_sec_lo;
|
||||
tm->tv_nsec = tv_nsec;
|
||||
}
|
||||
|
||||
static int
|
||||
timespec_diff_to_usec(const struct timespec *a, const struct timespec *b)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user