Skip to content

Commit d4a9045

Browse files
committed
Make test more resilient to differences between system_clock and steady_clock.
1 parent 7262dc3 commit d4a9045

File tree

1 file changed

+3
-2
lines changed
  • tests/std/tests/P0660R10_jthread_and_cv_any

1 file changed

+3
-2
lines changed

tests/std/tests/P0660R10_jthread_and_cv_any/test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ int main() {
234234
condition_variable_any cv;
235235
unique_lock lck{m};
236236
auto started_at = chrono::steady_clock::now();
237-
assert(cv.wait_for(lck, never_stopped.get_token(), 100ms, [] { return false; }) == false);
237+
auto until = started_at + 100ms;
238+
assert(cv.wait_until(lck, never_stopped.get_token(), until, [] { return false; }) == false);
238239
// not a timing assumption: the wait_for must wait at least that long
239-
assert(started_at + 100ms <= chrono::steady_clock::now());
240+
assert(until <= chrono::steady_clock::now());
240241
});
241242
}
242243

0 commit comments

Comments
 (0)