Timestamp update

This commit is contained in:
Pavel Kirienko
2015-08-17 14:12:24 +03:00
parent 181b4f6094
commit 04dc7d5e85
5 changed files with 6 additions and 8 deletions
+1 -1
Submodule dsdl updated: feca9d0061...d44bd52d00
+2 -2
View File
@@ -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;
}
};
@@ -14,6 +14,5 @@ TEST(DsdlConst1, Timestamp)
{
using uavcan::Timestamp;
std::cout << &Timestamp::USEC_PER_LSB << std::endl;
std::cout << &Timestamp::UNKNOWN << std::endl;
}
@@ -10,6 +10,5 @@ TEST(DsdlConst2, Timestamp)
{
using uavcan::Timestamp;
std::cout << &Timestamp::USEC_PER_LSB << std::endl;
std::cout << &Timestamp::UNKNOWN << std::endl;
}
+3 -3
View File
@@ -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