Skip to content

Commit 10fb71b

Browse files
[libc] Fix test passing negative value in timespec passed to nanosleep (#65346)
This test was setting tv_nsec to a negative value, which as per the standard this is an EINVAL: The value in the tv_nsec field was not in the range [0, 999999999] or tv_sec was negative. https://man7.org/linux/man-pages/man2/nanosleep.2.html
1 parent ce3bade commit 10fb71b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/test/src/time/gettimeofday_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ TEST(LlvmLibcGettimeofday, SmokeTest) {
2525
int ret = __llvm_libc::gettimeofday(&tv, tz);
2626
ASSERT_EQ(ret, 0);
2727

28-
int sleep_time = -sleep_times[i];
28+
int sleep_time = sleep_times[i];
2929
// Sleep for {sleep_time} microsceconds.
3030
struct timespec tim = {0, sleep_time * 1000};
3131
struct timespec tim2 = {0, 0};

0 commit comments

Comments
 (0)