| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2019-07-30 | fix tests | Artyom Pavlov | -0/+2 | |
| 2019-07-30 | mark div_duration methods as unstable, update tracking issue | Artyom Pavlov | -2/+2 | |
| 2019-07-17 | unconstify methods | newpavlov | -2/+2 | |
| 2019-07-17 | stabilize duration_float | newpavlov | -20/+10 | |
| 2019-04-19 | libcore: deny more... | Mazdak Farrokhzad | -2/+2 | |
| 2019-04-18 | libcore => 2018 | Taiki Endo | -5/+5 | |
| 2019-03-12 | fix typo | Artyom Pavlov | -1/+1 | |
| 2019-03-11 | fix test | Artyom Pavlov | -2/+2 | |
| 2019-03-11 | fix tests | newpavlov | -5/+9 | |
| 2019-03-11 | move MAX_NANOS_F64/32 to methods | newpavlov | -2/+4 | |
| 2019-03-11 | consistent naming for duration_float methods and additional f32 methods | newpavlov | -9/+121 | |
| 2019-02-23 | Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=oli-obk | Mazdak 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-21 | Enable feature duration_constants in examples | Stjepan Glavina | -0/+4 | |
| 2019-02-20 | Add examples for duration constants | Stjepan Glavina | -0/+32 | |
| 2019-02-20 | Turn duration consts into associated consts | Stjepan Glavina | -16/+16 | |
| 2019-02-10 | libs: doc comments | Alexander Regueiro | -1/+1 | |
| 2019-02-10 | tests: doc comments | Alexander Regueiro | -1/+1 | |
| 2019-01-07 | Specify the tracking issue | Stjepan Glavina | -4/+4 | |
| 2019-01-06 | Add duration constants | Stjepan Glavina | -0/+16 | |
| 2018-12-26 | Stabilize duration_as_u128 | Sunjay Varma | -6/+3 | |
| 2018-12-25 | Remove licenses | Mark Rousskov | -9/+0 | |
| 2018-12-07 | Various minor/cosmetic improvements to code | Alexander Regueiro | -3/+3 | |
| 2018-11-10 | constify parts of libstd. | Mazdak Farrokhzad | -0/+0 | |
| 2018-11-10 | constify libcore/time.rs | Mazdak Farrokhzad | -8/+4 | |
| 2018-10-31 | Bump nightly to 1.32.0 | Alex Crichton | -4/+4 | |
| * Also update the bootstrap compiler * Update cargo to 1.32.0 * Clean out stage0 annotations | ||||
| 2018-10-03 | Only promote calls to `#[rustc_promotable]` const fns | Oliver Schneider | -0/+4 | |
| 2018-09-20 | Rollup merge of #52813 - newpavlov:duration_mul_div_extras, r=alexcrichton | kennytm | -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-19 | Added tracking issue, fixed check, 1.30 -> 1.31 | Artyom Pavlov | -8/+8 | |
| 2018-09-13 | add panics section to method docs | Artyom Pavlov | -0/+9 | |
| 2018-09-13 | move checks to from_float_secs | Artyom Pavlov | -25/+15 | |
| 2018-09-13 | remove trailing spaces | Artyom Pavlov | -2/+2 | |
| 2018-09-13 | add as_float_secs and from_float_secs methods, refactor float methods | Artyom Pavlov | -36/+55 | |
| 2018-09-12 | fix tests | Artyom Pavlov | -3/+3 | |
| 2018-09-12 | fix tests | Artyom Pavlov | -1/+4 | |
| 2018-09-12 | fix doctests | Artyom Pavlov | -0/+6 | |
| 2018-09-12 | more explicit impl | Artyom Pavlov | -1/+1 | |
| 2018-09-12 | remove newline | Artyom Pavlov | -1/+0 | |
| 2018-09-12 | Move float ops to unstable inherent methods | Artyom Pavlov | -84/+83 | |
| 2018-08-04 | Remove redundant field names in structs | ljedrz | -4/+4 | |
| 2018-08-04 | 1.29.0 -> 1.30.0 | Артём Павлов [Artyom Pavlov] | -7/+7 | |
| 2018-07-31 | don't duplicate impls | Артём Павлов [Artyom Pavlov] | -17/+2 | |
| 2018-07-30 | change negativity check | Артём Павлов [Artyom Pavlov] | -12/+12 | |
| 2018-07-29 | add MAX_NANOS_F64 constant | Артём Павлов [Artyom Pavlov] | -3/+4 | |
| 2018-07-29 | review update | Артём Павлов [Artyom Pavlov] | -26/+19 | |
| 2018-07-29 | duration div mul extras | Артём Павлов [Artyom Pavlov] | -0/+115 | |
| 2018-07-14 | Make rounding down clear in duration documentation | Karoline Plum | -4/+4 | |
| Now also the documentations of `subsec_millis`, `subsec_micros`, `as_millis` and `as_micros` make clear that the fractional nanosecond component is rounded down to whole units. | ||||
| 2018-06-16 | Optimize sum of Durations by using custom function | Pazzaz | -2/+32 | |
| 2018-06-02 | Rollup merge of #50167 - fintelia:duration-nanos, r=sfackler | Mark Simulacrum | -0/+51 | |
| Add as_nanos function to Duration Duration has historically lacked a way to get the actual number of nanoseconds it contained as a normal Rust type because u64 was of insufficient range, and f64 of insufficient precision. The u128 type solves both issues, so I propose adding an `as_nanos` function to expose the capability. | ||||
| 2018-05-28 | Avoid 128-bit arithmetic where possible | Jonathan Behrens | -2/+2 | |
| 2018-05-26 | Auto merge of #50364 - LukasKalbertodt:improve-duration-debug-impl, r=KodrAus | bors | -1/+118 | |
| Improve `Debug` impl of `time::Duration` Hi there! For a long time now, I was getting annoyed by the derived `Debug` impl of `Duration`. Usually, I use `Duration` to either do quick'n'dirty benchmarking or measuring the time of some operation in general. The output of the derived Debug impl is hard to parse for humans: is { secs: 0, nanos: 968360102 } or { secs: 0, nanos 98507324 } longer? So after running into the annoyance several times (sometimes building my own function to print the Duration properly), I decided to tackle this. Now the output looks like this: ``` Duration::new(1, 0) => 1s Duration::new(1, 1) => 1.000000001s Duration::new(1, 300) => 1.0000003s Duration::new(1, 4000) => 1.000004s Duration::new(1, 600000) => 1.0006s Duration::new(1, 7000000) => 1.007s Duration::new(0, 0) => 0ns Duration::new(0, 1) => 1ns Duration::new(0, 300) => 300ns Duration::new(0, 4001) => 4.001µs Duration::new(0, 600300) => 600.3µs Duration::new(0, 7000000) => 7ms ``` Note that I implemented the formatting manually and didn't use floats. No information is "lost" when printing. So `Duration::new(123_456_789_000, 900_000_001)` prints as `123456789000.900000001s`. ~~This is not yet finished~~, but I wanted to open the PR now already in order to get some feedback (maybe everyone likes the derived impl). ### Still ToDo: - [x] Respect precision ~~and width~~ parameter of the formatter (see [this comment](https://github.com/rust-lang/rust/pull/50364#issuecomment-386107107)) ### Alternatives/Decisions - Should large durations displayed in minutes, hours, days, ...? For now, I decided not to because the current formatting is close the how a `Duration` is stored. From this new `Debug` output, you can still easily see what the values of `secs` and `nanos` are. A formatting like `3h 27m 12s 9ms` might be more appropriate for a `Display` impl? - Should this rather be a `Display` impl and should `Debug` be derived? Maybe this formatting is too fancy for `Debug`? In my opinion it's not and, as already mentioned, from the current format one can still very easily determine the values for `secs` and `nanos`. - Whitespace between the number and the unit? ### Notes for reviewers - ~~The combined diff sucks. Rather review both commits individually.~~ - ~~In the unit test, I am building my own type implementing `fmt::Write` to test the output. Maybe there is already something like that which I can use?~~ - My `Debug` impl block is marked as `#[stable(...)]`... but that's fine since the derived Debug impl was stable already, right? --- ~~Apart from the main change, I moved all `time` unit tests into the `tests` directory. All other `libcore` tests are there, so I guess it was simply an oversight. Prior to this change, the `time` tests weren't run, so I guess this is kind of a bug fix. If my `Debug` impl is rejected, I can of course just send the fix as PR.~~ (this was already merged in #50466) | ||||
