29 lines
571 B
C++
29 lines
571 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "timestamp.h"
|
|
|
|
TEST(TIMESTAMP, GET)
|
|
{
|
|
uint64_t sec = 0;
|
|
uint64_t msec = 0;
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
timestamp_update();
|
|
sec = timestamp_get_sec();
|
|
msec = timestamp_get_msec();
|
|
|
|
printf("current ts in sec : %lu\n", sec);
|
|
printf("current ts in msec : %lu\n", msec);
|
|
EXPECT_TRUE(sec == msec / 1000);
|
|
sleep(i);
|
|
printf("sleep %ds\n", i);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
return RUN_ALL_TESTS();
|
|
}
|