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 <richardcoch...@gmail.com>
---
 tmv.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tmv.h b/tmv.h
index cca4da7..f4a1a22 100644
--- a/tmv.h
+++ b/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;
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to