diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index fc00f9a4..e3e5dd0c 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -5811,9 +5811,10 @@ TEST_F(UsageTableTest, TimeRollbackPrevention) { ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, ¤t_time)); // Rollback the wall clock time. - current_time.tv_sec -= kLongDuration * 10; cout << "Rolling the system time back..." << endl; - ASSERT_EQ(0, clock_settime(CLOCK_REALTIME, ¤t_time)); + timeval current_time_of_day = {}; + current_time_of_day.tv_sec = current_time.tv_sec - kLongDuration * 10; + ASSERT_EQ(0, settimeofday(¤t_time_of_day, NULL)); // Try to playback again. ASSERT_NO_FATAL_FAILURE(s1.open()); @@ -5830,14 +5831,13 @@ TEST_F(UsageTableTest, TimeRollbackPrevention) { // Restore wall clock to its original position to verify that OEMCrypto does // not report negative times. ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, ¤t_time)); - current_time.tv_sec = + current_time_of_day.tv_sec = first_decrypt + current_time.tv_sec - first_decrypt_monotonic; cout << "Rolling the system time forward to the absolute time..." << endl; - ASSERT_EQ(0, clock_settime(CLOCK_REALTIME, ¤t_time)); - + ASSERT_EQ(0, settimeofday(¤t_time_of_day, NULL)); // Need to update time created since the verification checks the time of PST // report creation. - expected.time_created = current_time.tv_sec; + expected.time_created = current_time_of_day.tv_sec; ASSERT_NO_FATAL_FAILURE( s1.VerifyReport(expected, loaded, first_decrypt,