Skip to content

Commit ec10c36

Browse files
authored
[libc][NFC] Forcing data type in gettimeofday_test when comparing the diff. (#69652)
1 parent 65f946c commit ec10c36

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libc/test/src/time/gettimeofday_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ namespace cpp = LIBC_NAMESPACE::cpp;
1818
TEST(LlvmLibcGettimeofday, SmokeTest) {
1919
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
2020
void *tz = nullptr;
21-
struct timeval tv;
21+
timeval tv;
2222

23-
int sleep_times[2] = {200, 1000};
23+
suseconds_t sleep_times[2] = {200, 1000};
2424
for (int i = 0; i < 2; i++) {
2525
int ret = LIBC_NAMESPACE::gettimeofday(&tv, tz);
2626
ASSERT_EQ(ret, 0);
2727

28-
int sleep_time = sleep_times[i];
28+
suseconds_t sleep_time = sleep_times[i];
2929
// Sleep for {sleep_time} microsceconds.
30-
struct timespec tim = {0, sleep_time * 1000};
31-
struct timespec tim2 = {0, 0};
30+
timespec tim = {0, sleep_time * 1000};
31+
timespec tim2 = {0, 0};
3232
ret = LIBC_NAMESPACE::nanosleep(&tim, &tim2);
3333

3434
// Call gettimeofday again and verify that it is more {sleep_time}
3535
// microscecods.
36-
struct timeval tv1;
36+
timeval tv1;
3737
ret = LIBC_NAMESPACE::gettimeofday(&tv1, tz);
3838
ASSERT_EQ(ret, 0);
3939
ASSERT_GE(tv1.tv_usec - tv.tv_usec, sleep_time);

0 commit comments

Comments
 (0)