From 6325880094f86867dd7a6f41e5df4fd43c02789d Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Tue, 18 Aug 2020 02:19:27 +0300 Subject: [PATCH] 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 --- tmv.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tmv.h b/tmv.h index f4a1a22..9039534 100644 --- a/tmv.h +++ b/tmv.h @@ -20,6 +20,7 @@ #ifndef HAVE_TMV_H #define HAVE_TMV_H +#include #include #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