This is useful when dealing with timestamps returned by various ancillary PHC ioctl kernel APIs, such as extts.
Signed-off-by: Vladimir Oltean <olte...@gmail.com> --- tmv.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tmv.h b/tmv.h index f4a1a228ff6d..903953434586 100644 --- a/tmv.h +++ b/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 -- 2.25.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel