This will be needed in order to generate a TLV for the NSM protocol.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 tmv.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tmv.h b/tmv.h
index 30b41ee..5d1e12b 100644
--- a/tmv.h
+++ b/tmv.h
@@ -96,6 +96,21 @@ static inline TimeInterval tmv_to_TimeInterval(tmv_t x)
        return x << 16;
 }
 
+static inline struct Timestamp tmv_to_Timestamp(tmv_t x)
+{
+       struct Timestamp result;
+       uint64_t sec, nsec;
+
+       sec  = x / 1000000000ULL;
+       nsec = x % 1000000000ULL;
+
+       result.seconds_lsb = sec & 0xFFFFFFFF;
+       result.seconds_msb = (sec >> 32) & 0xFFFF;
+       result.nanoseconds = nsec;
+
+       return result;
+}
+
 static inline tmv_t timespec_to_tmv(struct timespec ts)
 {
        return ts.tv_sec * NS_PER_SEC + ts.tv_nsec;
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to