From 04dc7d5e85d482e9d028bdc039e99e289bd1c35a Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 17 Aug 2015 14:12:24 +0300 Subject: [PATCH] Timestamp update --- dsdl | 2 +- libuavcan/include/uavcan/time.hpp | 4 ++-- libuavcan/test/dsdl_test/dsdl_const_1.cpp | 1 - libuavcan/test/dsdl_test/dsdl_const_2.cpp | 1 - libuavcan/test/time.cpp | 6 +++--- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dsdl b/dsdl index feca9d0061..d44bd52d00 160000 --- a/dsdl +++ b/dsdl @@ -1 +1 @@ -Subproject commit feca9d0061e0345bf391fb77ca244e7e831d98c2 +Subproject commit d44bd52d006c0d5d68fc93193b7e68b39386c301 diff --git a/libuavcan/include/uavcan/time.hpp b/libuavcan/include/uavcan/time.hpp index 39528b045b..40bcb99449 100644 --- a/libuavcan/include/uavcan/time.hpp +++ b/libuavcan/include/uavcan/time.hpp @@ -200,14 +200,14 @@ public: UtcTime& operator=(const Timestamp& ts) { - *this = fromUSec(ts.husec * Timestamp::USEC_PER_LSB); + *this = fromUSec(ts.usec); return *this; } operator Timestamp() const { Timestamp ts; - ts.husec = toUSec() / Timestamp::USEC_PER_LSB; + ts.usec = toUSec(); return ts; } }; diff --git a/libuavcan/test/dsdl_test/dsdl_const_1.cpp b/libuavcan/test/dsdl_test/dsdl_const_1.cpp index 1eb0e5ed3b..593b9ade9a 100644 --- a/libuavcan/test/dsdl_test/dsdl_const_1.cpp +++ b/libuavcan/test/dsdl_test/dsdl_const_1.cpp @@ -14,6 +14,5 @@ TEST(DsdlConst1, Timestamp) { using uavcan::Timestamp; - std::cout << &Timestamp::USEC_PER_LSB << std::endl; std::cout << &Timestamp::UNKNOWN << std::endl; } diff --git a/libuavcan/test/dsdl_test/dsdl_const_2.cpp b/libuavcan/test/dsdl_test/dsdl_const_2.cpp index 62096c2af6..477db1fa75 100644 --- a/libuavcan/test/dsdl_test/dsdl_const_2.cpp +++ b/libuavcan/test/dsdl_test/dsdl_const_2.cpp @@ -10,6 +10,5 @@ TEST(DsdlConst2, Timestamp) { using uavcan::Timestamp; - std::cout << &Timestamp::USEC_PER_LSB << std::endl; std::cout << &Timestamp::UNKNOWN << std::endl; } diff --git a/libuavcan/test/time.cpp b/libuavcan/test/time.cpp index ce99755c42..18b3facd80 100644 --- a/libuavcan/test/time.cpp +++ b/libuavcan/test/time.cpp @@ -67,17 +67,17 @@ TEST(Time, Utc) using uavcan::Timestamp; Timestamp ts; - ts.husec = 90; + ts.usec = 9000; UtcTime u1(ts); ASSERT_EQ(9000, u1.toUSec()); - ts.husec *= 2; + ts.usec *= 2; u1 = ts; ASSERT_EQ(18000, u1.toUSec()); ts = UtcTime::fromUSec(12345678900); - ASSERT_EQ(123456789, ts.husec); + ASSERT_EQ(12345678900, ts.usec); /* * To string