[Linuxptp-devel] [RFC PATCH 12/15] tmv: introduce an initializer from nanoseconds
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
|
From: Vladimir O. <ol...@gm...> - 2020-08-01 17:46:57
|
Interestingly, although tmv_t is a wrapper over nanoseconds, there is no
initializer from a raw nanosecond value. So add one.
Signed-off-by: Vladimir Oltean <ol...@gm...>
---
tmv.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tmv.h b/tmv.h
index 903953434586..0c1155f02f04 100644
--- a/tmv.h
+++ b/tmv.h
@@ -112,6 +112,13 @@ static inline int64_t tmv_to_nanoseconds(tmv_t x)
return x.ns;
}
+static inline tmv_t nanoseconds_to_tmv(int64_t ns)
+{
+ tmv_t t;
+ t.ns = ns;
+ return t;
+}
+
static inline TimeInterval tmv_to_TimeInterval(tmv_t x)
{
if (x.ns < (int64_t)MIN_TMV_TO_TIMEINTERVAL) {
--
2.25.1
|