patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -13,15 +13,19 @@
#include <gtest/gtest.h>
#include "lib/ob_define.h"
#include <sys/time.h>
#include "lib/ob_errno.h"
#include "lib/time/ob_tsc_timestamp.h"
namespace oceanbase {
namespace common {
namespace oceanbase
{
namespace common
{
inline int64_t current_time()
{
struct timeval t;
if (gettimeofday(&t, NULL) < 0) {}
if (gettimeofday(&t, NULL) < 0) {
}
return (static_cast<int64_t>(t.tv_sec) * static_cast<int64_t>(1000000) + static_cast<int64_t>(t.tv_usec));
}
@ -32,19 +36,19 @@ TEST(TestObTscTimestamp, common)
ASSERT_EQ(OB_SUCCESS, ret);
int64_t time2 = current_time();
ASSERT_EQ(time1 / 100000, time2 / 100000);
usleep(3000000); // 3s
usleep(3000000);//3s
time1 = OB_TSC_TIMESTAMP.current_time();
ASSERT_EQ(OB_SUCCESS, ret);
time2 = current_time();
ASSERT_EQ(time1 / 100000, time2 / 100000);
}
} // namespace common
} // namespace oceanbase
}//common
}//oceanbase
int main(int argc, char** argv)
int main(int argc, char **argv)
{
// oceanbase::common::ObLogger::get_logger().set_log_level("WARN");
//oceanbase::common::ObLogger::get_logger().set_log_level("WARN");
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}