about summary refs log tree commit diff
path: root/library/std/src/time.rs
AgeCommit message (Collapse)AuthorLines
2021-09-04linux/aarch64 Now() should be actually_monotonic()Ali Saidi-0/+14
While issues have been seen on arm64 platforms the Arm architecture requires that the counter monotonically increases and that it must provide a uniform view of system time (e.g. it must not be possible for a core to receive a message from another core with a time stamp and observe time going backwards (ARM DDI 0487G.b D11.1.2). While there have been a few 64bit SoCs that have bugs (#49281, #56940) which cause time to not monotonically increase, these have been fixed in the Linux kernel and we shouldn't penalize all Arm SoCs for those who refuse to update their kernels: SUN50I_ERRATUM_UNKNOWN1 - Allwinner A64 / Pine A64 - fixed in 5.1 FSL_ERRATUM_A008585 - Freescale LS2080A/LS1043A - fixed in 4.10 HISILICON_ERRATUM_161010101 - Hisilicon 1610 - fixed in 4.11 ARM64_ERRATUM_858921 - Cortex A73 - fixed in 4.12 255a3f3e183 std: Force `Instant::now()` to be monotonic added a mutex to work around this problem and a small test program using glommio shows the majority of time spent acquiring and releasing this Mutex. 3914a7b0da8 tries to improve this, but actually makes it worse on big systems as for 128b atomics a ldxp/stxp pair (and successful loop) is required which is expensive as a lock and because of how the load/store-exclusives scale on large Arm systems is both unfair to threads and tends to go backwards in performance.
2021-08-29Adding examples to docs of std::time moduleJoão M. Bezerra-6/+25
And adding missing link to Duration from Instant
2021-08-13where available use 64- or 128bit atomics instead of a Mutex to monotonize timeThe8472-10/+2
2021-07-29Fix may not to appropriate might not or must notAli Malik-2/+2
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-04Fix invalid align attribute generation on <td> elementsGuillaume Gomez-2/+2
2020-11-22Drop support for cloudabi targetsLzu Tao-4/+0
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-1/+1
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-10-06Rollup merge of #76388 - poliorcetics:system-time-document-panic, r=KodrAusYuki Okushi-0/+10
Add a note about the panic behavior of math operations on time objects Fixes #71226.
2020-09-27Split sys_common::Mutex in StaticMutex and MovableMutex.Mara Bos-2/+2
The (unsafe) Mutex from sys_common had a rather complicated interface. You were supposed to call init() manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if destroy() should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this Mutex, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither init() nor destroy() are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the LockGuard, never with raw_lock. 2. As a Boxed variable. In this case, both init() and destroy() are called, it will be moved and possibly used reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. The interface of both new types is now both safer and simpler. The first one does not call nor expose init/destroy, and the second one calls those automatically in its new() and Drop functions. Also, the locking functions of MovableMutex are no longer unsafe.
2020-09-09Rollup merge of #76162 - abrausch:documentation-fix-duration_since, r=jyn514Dylan DPC-3/+4
Make duration_since documentation more clear
2020-09-08Make duration_since documentation more clearAlexander Brausch-3/+4
2020-09-05Add a note about the panic behavior of math operations on time objectsAlexis Bourget-0/+10
2020-09-04time.rs: Make spelling of "Darwin" consistentnumbermaniac-1/+1
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-169/+3
Also doing fmt inplace as requested.
2020-08-22Update docs for SystemTime Windows implementationOliver Middleton-1/+2
Windows now uses `GetSystemTimePreciseAsFileTime` on versions of Windows that support it.
2020-08-12Use explicit path link in place for doc in timeIvan Tham-6/+2
2020-08-11Remove two links by changing the doc for SystemTimeError::durationAlexis Bourget-6/+3
2020-08-10Move to doc links inside std/time.rsAlexis Bourget-24/+4
2020-07-27mv std libs to library/mark-0/+827