summary refs log tree commit diff
path: root/src/libstd/time
AgeCommit message (Collapse)AuthorLines
2014-10-28Fix the output of negative durationVladimir Smola-13/+18
Technically speaking, negative duration is not valid ISO 8601, but we need to print it anyway. If `d` is a positive duration with the output `xxxxxxx`, then the expected output of negative `-d` value is `-xxxxxxx`. I.e. the idea is to print negative durations as positive with a leading minus sign. Closes #18181.
2014-10-09std: Convert statics to constantsAlex Crichton-13/+13
This commit repurposes most statics as constants in the standard library itself, with the exception of TLS keys which precisely have their own memory location as an implementation detail. This commit also rewrites the bitflags syntax to use `const` instead of `static`. All invocations will need to replace the word `static` with `const` when declaring flags. Due to the modification of the `bitflags!` syntax, this is a: [breaking-change]
2014-09-03Fix spelling errors and capitalization.Joseph Crail-1/+1
2014-08-28libstd: Wrap duration.rs at 100 characters.Ruud van Asseldonk-3/+6
2014-08-21libstd: Limit Duration range to i64 milliseconds.Ruud van Asseldonk-39/+49
This enables `num_milliseconds` to return an `i64` again instead of `Option<i64>`, because it is guaranteed not to overflow. The Duration range is now rougly 300e6 years (positive and negative), whereas it was 300e9 years previously. To put these numbers in perspective, 300e9 years is about 21 times the age of the universe (according to Wolfram|Alpha). 300e6 years is about 1/15 of the age of the earth (according to Wolfram|Alpha).
2014-08-20libstd: Refactor Duration.Ruud van Asseldonk-282/+190
This changes the internal representation of `Duration` from days: i32, secs: i32, nanos: u32 to secs: i64, nanos: i32 This resolves #16466. Some methods now take `i64` instead of `i32` due to the increased range. Some methods, like `num_milliseconds`, now return an `Option<i64>` instead of `i64`, because the range of `Duration` is now larger than e.g. 2^63 milliseconds.
2014-08-15Derive Clone for std::time::DurationAndrew Poelstra-1/+1
This is needed to derive Clone for types containing Durations.
2014-08-13Add a fixme about Duration representationBrian Anderson-0/+2
2014-08-13Update docsBrian Anderson-2/+5
2014-08-13std: Fix build errorsBrian Anderson-1/+1
2014-08-13std: Remove Duration::new/new_opt/to_tupleBrian Anderson-37/+0
These all expose the underlying data representation and are not the most convenient way of instantiation anyway.
2014-08-13std: Improve Duration commentsBrian Anderson-17/+2
2014-08-13std: Refactor time module a bitBrian Anderson-0/+696
Put `Duration` in `time::duration`, where the two constants can be called just `MAX` and `MIN`. Reexport from `time`. This provides more room for the time module to expand.