This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/src/timestamp/test/gtest_timestamp.cpp

29 lines
571 B
C++
Raw Normal View History

2023-12-13 18:31:10 +08:00
#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();
}