tmv: introduce a conversion helper from ptp_clock_time
This is useful when dealing with timestamps returned by various ancillary PHC ioctl kernel APIs, such as extts. Signed-off-by: Vladimir Oltean <olteanv@gmail.com>master
parent
226c285ec4
commit
6325880094
8
tmv.h
8
tmv.h
|
@ -20,6 +20,7 @@
|
|||
#ifndef HAVE_TMV_H
|
||||
#define HAVE_TMV_H
|
||||
|
||||
#include <linux/ptp_clock.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "ddt.h"
|
||||
|
@ -160,4 +161,11 @@ static inline tmv_t timestamp_to_tmv(struct timestamp ts)
|
|||
return t;
|
||||
}
|
||||
|
||||
static inline tmv_t pct_to_tmv(struct ptp_clock_time pct)
|
||||
{
|
||||
tmv_t t;
|
||||
t.ns = pct.sec * NS_PER_SEC + pct.nsec;
|
||||
return t;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue