about summary refs log tree commit diff
path: root/src/libstd/time/duration.rs
AgeCommit message (Collapse)AuthorLines
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-71/+60
2014-11-05Repair various cases where values of distinct types were being operatedNiko Matsakis-1/+1
upon (e.g., `&int` added to `int`).
2014-10-30auto merge of #18359 : 1-more/rust/feature, r=alexcrichtonbors-13/+18
2014-10-29Rename fail! to panic!Steve Klabnik-1/+1
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
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/+681
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.