Provide a method to convert a tmv_t into a timespec.

Currently there is a method to convert a timespec into a tmv_t, but
not the other way round.  This patch adds the missing function in
anticipation of a new feature that will need this conversion.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2020-01-16 21:16:37 -08:00
parent 43d49a21d0
commit b829580a33
1 changed files with 10 additions and 0 deletions

10
tmv.h
View File

@ -143,6 +143,16 @@ static inline tmv_t timespec_to_tmv(struct timespec ts)
return t;
}
static inline struct timespec tmv_to_timespec(tmv_t t)
{
struct timespec ts;
ts.tv_sec = t.ns / NS_PER_SEC;
ts.tv_nsec = t.ns % NS_PER_SEC;
return ts;
}
static inline tmv_t timestamp_to_tmv(struct timestamp ts)
{
tmv_t t;