mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-03 21:26:36 +00:00
os/time: Add function to convert to a timespec struct
This commit is contained in:
parent
b75f4f844b
commit
ef282c7df2
|
@ -82,6 +82,17 @@ os_timespec_to_ns(struct timespec *spec)
|
|||
ns += (uint64_t)spec->tv_nsec;
|
||||
return ns;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Convert an nanosecond integer to a timespec struct.
|
||||
* @ingroup aux_os_time_extra
|
||||
*/
|
||||
static inline void
|
||||
os_ns_to_timespec(uint64_t ns, struct timespec *spec)
|
||||
{
|
||||
spec->tv_sec = (ns / (1000 * 1000 * 1000));
|
||||
spec->tv_nsec = (ns % (1000 * 1000 * 1000));
|
||||
}
|
||||
#endif // XRT_HAVE_TIMESPEC
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue