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
parent
43d49a21d0
commit
b829580a33
10
tmv.h
10
tmv.h
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue