Skip to content

Commit

Permalink
Rollup merge of rust-lang#37699 - alexcrichton:default-for-duration, …
Browse files Browse the repository at this point in the history
…r=brson

std: Derive `Default` for `Duration`.

Discussed in rust-lang#37546 the libs team reached the conclusion that a default zero
duration seems like a reasonable implementation of the `Default` trait.

Closes rust-lang#37546
  • Loading branch information
eddyb authored Nov 11, 2016
2 parents 304d409 + 30502b8 commit 0db7d5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/time/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MILLIS_PER_SEC: u64 = 1_000;
/// let ten_millis = Duration::from_millis(10);
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
pub struct Duration {
secs: u64,
nanos: u32, // Always 0 <= nanos < NANOS_PER_SEC
Expand Down

0 comments on commit 0db7d5a

Please sign in to comment.