| 22 | namespace tera { |
| 23 | |
| 24 | TEST(TimerTest, Basic) { |
| 25 | struct timespec ts1, ts2, ts3; |
| 26 | struct timeval tv; |
| 27 | |
| 28 | clock_gettime(CLOCK_MONOTONIC, &ts1); |
| 29 | clock_gettime(CLOCK_MONOTONIC_RAW, &ts3); |
| 30 | clock_gettime(CLOCK_REALTIME, &ts2); |
| 31 | gettimeofday(&tv, NULL); |
| 32 | |
| 33 | std::cout << "ts1.tv_sec " << ts1.tv_sec << ", ts1.tv_nsec " << ts1.tv_nsec << std::endl; |
| 34 | std::cout << "ts2.tv_sec " << ts2.tv_sec << ", ts2.tv_nsec " << ts2.tv_nsec << std::endl; |
| 35 | std::cout << "ts3.tv_sec " << ts3.tv_sec << ", ts3.tv_nsec " << ts3.tv_nsec << std::endl; |
| 36 | std::cout << "tv.tv_sec " << tv.tv_sec << ", tv.tv_usec " << tv.tv_usec << std::endl; |
| 37 | |
| 38 | int delta = 0; |
| 39 | delta = ts2.tv_sec - tv.tv_sec; |
| 40 | ASSERT_TRUE(-1 <= delta && delta <= 1); |
| 41 | ASSERT_TRUE(ts1.tv_sec < ts2.tv_sec); |
| 42 | ASSERT_TRUE(ts1.tv_sec < tv.tv_sec); |
| 43 | } |
| 44 | |
| 45 | TEST(TimerTest, test1) { |
| 46 | struct timespec ts1; |
nothing calls this directly
no test coverage detected