diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2021-04-11 17:40:19 -0400 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2021-04-11 17:40:19 -0400 |
| commit | 93cf9560b13619159efb3ca12eeeb13d6031ad85 (patch) | |
| tree | 4b5857db65268b6e3a41fc436082da7b100647b6 /lib/std/time.zig | |
| parent | 86b31394c9d73b0f753918cea4f08ce8d7a26119 (diff) | |
| parent | 82a31aac9b955213f47ff3b2a2c7eb932fdbe294 (diff) | |
| download | zig-93cf9560b13619159efb3ca12eeeb13d6031ad85.tar.gz zig-93cf9560b13619159efb3ca12eeeb13d6031ad85.zip | |
Merge remote-tracking branch 'origin/master' into llvm12
Diffstat (limited to 'lib/std/time.zig')
| -rw-r--r-- | lib/std/time.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/std/time.zig b/lib/std/time.zig index 7435a67e3d..f0118d2642 100644 --- a/lib/std/time.zig +++ b/lib/std/time.zig @@ -271,7 +271,9 @@ test "timestamp" { sleep(ns_per_ms); const time_1 = milliTimestamp(); const interval = time_1 - time_0; - testing.expect(interval > 0 and interval < margin); + testing.expect(interval > 0); + // Tests should not depend on timings: skip test if outside margin. + if (!(interval < margin)) return error.SkipZigTest; } test "Timer" { @@ -280,7 +282,9 @@ test "Timer" { var timer = try Timer.start(); sleep(10 * ns_per_ms); const time_0 = timer.read(); - testing.expect(time_0 > 0 and time_0 < margin); + testing.expect(time_0 > 0); + // Tests should not depend on timings: skip test if outside margin. + if (!(time_0 < margin)) return error.SkipZigTest; const time_1 = timer.lap(); testing.expect(time_1 >= time_0); |
