1 #include <gtest/gtest.h> 2 #include <sys/timeb.h> 3 #include <time.h> 4 using namespace testing::ext; 5 6 class TimeTimezoneTest : public testing::Test { SetUp()7 void SetUp() override {} TearDown()8 void TearDown() override {} 9 }; 10 11 /** 12 * @tc.name: timezone_001 13 * @tc.desc: Test the functionality of the clock_gettime function and the timezone field of the timeb structure. 14 * @tc.type: FUNC 15 **/ 16 HWTEST_F(TimeTimezoneTest, timezone_001, TestSize.Level1) 17 { 18 struct timeb tp; 19 struct timespec ts; 20 clock_gettime(CLOCK_REALTIME, &ts); 21 tp.timezone = tp.dstflag; 22 EXPECT_EQ(0, tp.timezone); 23 }