about summary refs log tree commit diff
path: root/library/std/src/time/tests.rs
AgeCommit message (Collapse)AuthorLines
2022-02-13make Instant::{duration_since, elapsed, sub} saturating and remove workaroundsThe8472-28/+3
This removes all mutex/atomics based workarounds for non-monotonic clocks and makes the previously panicking methods saturating instead. Effectively this moves the monotonization from `Instant` construction to the comparisons. This has some observable effects, especially on platforms without monotonic clocks: * Incorrectly ordered Instant comparisons no longer panic. This may hide some programming errors until someone actually looks at the resulting `Duration` * `checked_duration_since` will now return `None` in more cases. Previously it only happened when one compared instants obtained in the wrong order or manually created ones. Now it also does on backslides. The upside is reduced complexity and lower overhead of `Instant::now`.
2021-10-30Add #[must_use] to remaining std functions (O-Z)John Kugelman-2/+2
2021-08-20fix tests on wasm targets that have 32bit time_t and don't have threadsThe8472-2/+12
2021-08-16correct overflows in the backslide case, add testThe8472-0/+18
2021-08-13add benchmarks for 1, 2, 4, 8, 16 threadsThe8472-0/+43
2021-08-13where available use 64- or 128bit atomics instead of a Mutex to monotonize timeThe8472-2/+27
2020-10-21Duration::zero() -> Duration::ZEROJubilee Young-3/+3
Duration::ZERO composes better with match and various other things, at the cost of an occasional parens, and results in less work for the optimizer, so let's use that instead.
2020-10-21Dogfood Duration API in std::time testsJubilee Young-16/+16
This expands time's test suite to use more and in more places the range of methods and constants added to Duration in recent proposals for the sake of testing more API surface area and improving legibility.
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-0/+165
Also doing fmt inplace as requested.