about summary refs log tree commit diff
path: root/src/libstd/time.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-827/+0
2020-07-10Avoid "whitelist"Tamir Duberstein-1/+1
Other terms are more inclusive and precise.
2020-06-20Rollup merge of #73171 - tblah:riscv-qemu-test, r=pietroalbiniRalf Jung-2/+2
RISC-V Emulated Testing Adds a disabled docker image on which to run RISC-V tests. Based on the armhf image. Test using ``` ./src/ci/docker/run.sh riscv64gc-linux ``` cc: @msizanoen1
2020-06-18Rollup merge of #72836 - poliorcetics:std-time-os-specificities, r=shepmasterManish Goregaokar-0/+15
Complete the std::time documentation to warn about the inconsistencies between OS Fixes #48980. I put the new documentation in `src/libstd/time.rs` at the module-level because it affects all types, even the one that are not directly system dependents if they are used with affected types, but there may be a better place for it.
2020-06-15Complete the std::time documentation to warn about the inconsistencies ↵Alexis Bourget-0/+15
between OS
2020-06-10Migrate to numeric associated constsLzu Tao-2/+2
2020-06-09Mark tests whcih don't work under riscv emulationTom Eccles-2/+2
2020-02-29correct comment to match behaviorZan Tysor-1/+1
2020-01-28Update links to WASI docs in time.rs moduleJakub Konka-2/+2
Since the docs for the WASI API are now evolving in [WebAssembly/WASI] repo, I thought it might be useful to update the links in the docs to point to that location instead of using the outdated `CraneStation/wasmtime` destination. [WebAssembly/WASI]: https://github.com/WebAssembly/WASI
2020-01-18Fix table of syscalls in docs of std::time::SystemTime.Mara Bos-2/+2
2020-01-18Fix table of syscalls in docs of std::time::Instant.Mara Bos-2/+2
2020-01-12Fix system call docs for time::InstantRuud van Asseldonk-1/+1
The link for UNIX was pointing to the Cloud ABI docs. It should have been pointing to the clock_gettime docs instead. The table is repeated in the docs for SystemTime, but there the UNIX entry was already correct.
2019-12-31Add missing links for insecure_timeLzu Tao-0/+2
2019-12-24Deprecate Error::description for realDavid Tolnay-0/+1
`description` has been documented as soft-deprecated since 1.27.0 (17 months ago). There is no longer any reason to call it or implement it. This commit: - adds #[rustc_deprecated(since = "1.41.0")] to Error::description; - moves description (and cause, which is also deprecated) below the source and backtrace methods in the Error trait; - reduces documentation of description and cause to take up much less vertical real estate in rustdocs, while preserving the example that shows how to render errors without needing to call description; - removes the description function of all *currently unstable* Error impls in the standard library; - marks #[allow(deprecated)] the description function of all *stable* Error impls in the standard library; - replaces miscellaneous uses of description in example code and the compiler.
2019-10-05Fix typo on `now()` commentsBO41-28/+23
2019-09-14Rollup merge of #63846 - DevQps:32626-document-time-system-calls, r=rkruppeMazdak Farrokhzad-0/+46
Added table containing the system calls used by Instant and SystemTime. # Description See #32626 for a discussion on documenting system calls used by Instant and SystemTime. ## Changes - Added a table containing the system calls used by each platform. EDIT: If I can format this table better (due to the large links) please let me know. I'd also be happy to learn a quick command to generate the docs on my host machine! Currently I am using: `python x.py doc --stage 0 src/libstd` but that gives me some `unrecognized intrinsic` errors. Advice is always welcome :) closes #32626
2019-09-13Update src/libstd/time.rsChristian Veenman-1/+1
Co-Authored-By: Robin Kruppe <robin.kruppe@gmail.com>
2019-09-09Changed instant is earlier to instant is laterhman523-1/+1
2019-09-09Added some context on SGX. Lists Darwin separately.Christian-18/+32
2019-09-05Stabilize checked_duration_since for 1.39.0Vitaly _Vi Shukela-4/+2
Resolves #58402.
2019-08-26Update src/libstd/time.rsChristian Veenman-1/+3
Co-Authored-By: lzutao <taolzu@gmail.com>
2019-08-24Added table containing the system calls used by Instant and SystemTime.Christian-0/+30
2019-07-28SystemTime docs: recommend Instant for elapsed timeKornel-2/+8
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-3/+3
2019-03-22Make duration_since use checked_duration_sinceLinus Färnstrand-6/+2
2019-03-22Add/rename checked_duration_since testsLinus Färnstrand-6/+9
2019-03-12Make std time tests more robust for platform differencesJethro Beekman-9/+2
2019-02-28libstd => 2018Taiki Endo-8/+8
2019-02-23Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=oli-obkMazdak Farrokhzad-3/+0
Turn duration consts into associated consts As suggested in https://github.com/rust-lang/rust/issues/57391#issuecomment-459658236, I'm moving `Duration` constants (`SECOND`, `MILLISECOND` and so on; currently behind unstable `duration_constants` feature) into the `impl Duration` block. cc @frewsxcv @SimonSapin
2019-02-20Turn duration consts into associated constsStjepan Glavina-3/+0
2019-02-17Rollup merge of #58395 - vi:checked_duration_since, r=dtolnaykennytm-0/+60
Instant::checked_duration_since
2019-02-13Add Instant::saturating_duration_sinceVitaly _Vi Shukela-0/+28
2019-02-13Fix tests for checked_duration_sinceVitaly _Vi Shukela-1/+3
2019-02-13Rollup merge of #58034 - faern:stabilize-time-checked-add, r=alexcrichtonMazdak Farrokhzad-8/+8
Stabilize the time_checked_add feature Closes #55940 Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
2019-02-13Add Instant::checked_duration_since, address #58402.Vitaly _Vi Shukela-0/+30
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-01-31Simplify lambdasLinus Färnstrand-4/+4
2019-01-31Stabilize the time_checked_add featureLinus Färnstrand-4/+4
2019-01-22Simplify units in Duration/Instant math on WindowsAlex Berghage-0/+9
Right now we do unit conversions between PerfCounter measurements and nanoseconds for every add/sub we do between Durations and Instants on Windows machines. This leads to goofy behavior, like this snippet failing: ``` let now = Instant::now(); let offset = Duration::from_millis(5); assert_eq!((now + offset) - now, (now - now) + offset); ``` with precision problems like this: ``` thread 'main' panicked at 'assertion failed: `(left == right)` left: `4.999914ms`, right: `5ms`', src\main.rs:6:5 ``` To fix it, this changeset does the unit conversion once, when we measure the clock, and all the subsequent math in u64 nanoseconds. It also adds an exact associativity test to the `sys/time.rs` test suite to make sure we don't regress on this in the future.
2019-01-08Auto merge of #56988 - alexcrichton:monotonic-instant, r=sfacklerbors-1/+41
std: Force `Instant::now()` to be monotonic This commit is an attempt to force `Instant::now` to be monotonic through any means possible. We tried relying on OS/hardware/clock implementations, but those seem buggy enough that we can't rely on them in practice. This commit implements the same hammer Firefox recently implemented (noted in #56612) which is to just keep whatever the lastest `Instant::now()` return value was in memory, returning that instead of the OS looks like it's moving backwards. Closes #48514 Closes #49281 cc #51648 cc #56560 Closes #56612 Closes #56940
2019-01-07std: Force `Instant::now()` to be monotonicAlex Crichton-1/+41
This commit is an attempt to force `Instant::now` to be monotonic through any means possible. We tried relying on OS/hardware/clock implementations, but those seem buggy enough that we can't rely on them in practice. This commit implements the same hammer Firefox recently implemented (noted in #56612) which is to just keep whatever the lastest `Instant::now()` return value was in memory, returning that instead of the OS looks like it's moving backwards. Closes #48514 Closes #49281 cc #51648 cc #56560 Closes #56612 Closes #56940
2019-01-07Rollup merge of #57375 - stjepang:duration-constants, r=joshtriplettPietro Albini-0/+3
Add duration constants Add constants `SECOND`, `MILLISECOND`, `MICROSECOND`, and `NANOSECOND` to `core::time`. This will make working with durations more ergonomic. Compare: ```rust // Convenient, but deprecated function. thread::sleep_ms(2000); // The current canonical way to sleep for two seconds. thread::sleep(Duration::from_secs(2)); // Sleeping using one of the new constants. thread::sleep(2 * SECOND); ```
2019-01-07Specify the tracking issueStjepan Glavina-1/+1
2019-01-06Re-export constants from core into stdStjepan Glavina-0/+3
2019-01-02Auto merge of #56827 - faern:eliminate-recv-timeout-panic, r=KodrAusbors-0/+12
Eliminate Receiver::recv_timeout panic Fixes #54552. This panic is because `recv_timeout` uses `Instant::now() + timeout` internally. This possible panic is not mentioned in the documentation for this method. Very recently we merged (still unstable) support for checked addition (#56490) of `Instant + Duration`, so it's now finally possible to add these together without risking a panic.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-14Add documentation about panicking Add<Duration> implsLinus Färnstrand-0/+12
2018-12-13Add checked_sub for Instant and SystemTimeLinus Färnstrand-2/+22
2018-12-13Add checked_add method to Instant time typeLinus Färnstrand-2/+25
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1