about summary refs log tree commit diff
path: root/src/libcore/time.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-1006/+0
2020-07-15Constify most non-trait `Duration` methods as described in #72440marmeladema-19/+28
2020-06-20Revise according to reviewJon Gjengset-21/+19
2020-06-20Doctests need featureJon Gjengset-0/+2
2020-06-20core/time: Add Duration methods for zeroJon Gjengset-1/+42
This patch adds two methods to `Duration`. The first, `Duration::zero`, provides a `const` constructor for getting an zero-length duration. This is also what `Default` provides (this was clarified in the docs), though `default` is not `const`. The second, `Duration::is_zero`, returns true if a `Duration` spans no time (i.e., because its components are all zero). Previously, the way to do this was either to compare both `as_secs` and `subsec_nanos` to 0, to compare against `Duration::new(0, 0)`, or to use the `u128` method `as_nanos`, none of which were particularly elegant.
2020-05-02de-promote Duration::from_secsRalf Jung-1/+0
2020-04-20Stop accessing module level int consts via crate::<Ty>Linus Färnstrand-1/+1
2020-04-03Make documentation examples use new integer assoc constsLinus Färnstrand-2/+2
2019-12-22no longer promote non-pattern const functionsRalf Jung-3/+0
2019-12-18Propagate cfg bootstrapMark Rousskov-12/+12
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+12
functions with a `const` modifier
2019-11-26Format libcore with rustfmtDavid Tolnay-39/+33
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-1/+1
2019-07-30fix testsArtyom Pavlov-0/+2
2019-07-30mark div_duration methods as unstable, update tracking issueArtyom Pavlov-2/+2
2019-07-17unconstify methodsnewpavlov-2/+2
2019-07-17stabilize duration_floatnewpavlov-20/+10
2019-04-19libcore: deny more...Mazdak Farrokhzad-2/+2
2019-04-18libcore => 2018Taiki Endo-5/+5
2019-03-12fix typoArtyom Pavlov-1/+1
2019-03-11fix testArtyom Pavlov-2/+2
2019-03-11fix testsnewpavlov-5/+9
2019-03-11move MAX_NANOS_F64/32 to methodsnewpavlov-2/+4
2019-03-11consistent naming for duration_float methods and additional f32 methodsnewpavlov-9/+121
2019-02-23Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=oli-obkMazdak Farrokhzad-16/+52
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-21Enable feature duration_constants in examplesStjepan Glavina-0/+4
2019-02-20Add examples for duration constantsStjepan Glavina-0/+32
2019-02-20Turn duration consts into associated constsStjepan Glavina-16/+16
2019-02-10libs: doc commentsAlexander Regueiro-1/+1
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-01-07Specify the tracking issueStjepan Glavina-4/+4
2019-01-06Add duration constantsStjepan Glavina-0/+16
2018-12-26Stabilize duration_as_u128Sunjay Varma-6/+3
2018-12-25Remove licensesMark Rousskov-9/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-3/+3
2018-11-10constify parts of libstd.Mazdak Farrokhzad-0/+0
2018-11-10constify libcore/time.rsMazdak Farrokhzad-8/+4
2018-10-31Bump nightly to 1.32.0Alex Crichton-4/+4
* Also update the bootstrap compiler * Update cargo to 1.32.0 * Clean out stage0 annotations
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-0/+4
2018-09-20Rollup merge of #52813 - newpavlov:duration_mul_div_extras, r=alexcrichtonkennytm-1/+120
Duration div mul extras Successor of #52556. This PR adds the following `impl`s: - `impl Mul<Duration> for u32` (to allow `10*SECOND` in addition to `SECOND*10`) - `impl Mul<f64> for Duration` (to allow `2.5*SECOND` vs `2*SECOND + 500*MILLISECOND`) - `impl Mul<Duration> for f64` - `impl MulAssign<f64> for Duration` - `impl Div<f64> for Duration` - `impl DivAssign<f64> for Duration` - `impl Div<Duration> for Duration` (`Output = f64`, can be useful e.g. for `duration/MINUTE`) `f64` is chosen over `f32` to minimize rounding errors. (52 bits fraction precision vs `Duration`'s ~94 bit)
2018-09-19Added tracking issue, fixed check, 1.30 -> 1.31Artyom Pavlov-8/+8
2018-09-13add panics section to method docsArtyom Pavlov-0/+9
2018-09-13move checks to from_float_secsArtyom Pavlov-25/+15
2018-09-13remove trailing spacesArtyom Pavlov-2/+2
2018-09-13add as_float_secs and from_float_secs methods, refactor float methodsArtyom Pavlov-36/+55
2018-09-12fix testsArtyom Pavlov-3/+3
2018-09-12fix testsArtyom Pavlov-1/+4
2018-09-12fix doctestsArtyom Pavlov-0/+6
2018-09-12more explicit implArtyom Pavlov-1/+1
2018-09-12remove newlineArtyom Pavlov-1/+0