@@ -30,7 +30,7 @@ const NANOS_PER_MILLI: u32 = 1_000_000;
3030const NANOS_PER_MICRO : u32 = 1_000 ;
3131const MILLIS_PER_SEC : u64 = 1_000 ;
3232const MICROS_PER_SEC : u64 = 1_000_000 ;
33- const MAX_NANOS_F64 : f64 = ( ( u64:: MAX as u128 + 1 ) * ( NANOS_PER_SEC as u128 ) - 1 ) as f64 ;
33+ const MAX_NANOS_F64 : f64 = ( ( u64:: MAX as u128 + 1 ) * ( NANOS_PER_SEC as u128 ) ) as f64 ;
3434
3535/// A `Duration` type to represent a span of time, typically used for system
3636/// timeouts.
@@ -472,7 +472,7 @@ impl Duration {
472472 /// let dur = Duration::new(2, 700_000_000);
473473 /// assert_eq!(dur.as_float_secs(), 2.7);
474474 /// ```
475- #[ unstable( feature = "duration_float" , issue = "0 " ) ]
475+ #[ unstable( feature = "duration_float" , issue = "54361 " ) ]
476476 #[ inline]
477477 pub fn as_float_secs ( & self ) -> f64 {
478478 ( self . secs as f64 ) + ( self . nanos as f64 ) / ( NANOS_PER_SEC as f64 )
@@ -491,14 +491,14 @@ impl Duration {
491491 /// let dur = Duration::from_float_secs(2.7);
492492 /// assert_eq!(dur, Duration::new(2, 700_000_000));
493493 /// ```
494- #[ unstable( feature = "duration_float" , issue = "0 " ) ]
494+ #[ unstable( feature = "duration_float" , issue = "54361 " ) ]
495495 #[ inline]
496496 pub fn from_float_secs ( secs : f64 ) -> Duration {
497497 let nanos = secs * ( NANOS_PER_SEC as f64 ) ;
498498 if !nanos. is_finite ( ) {
499499 panic ! ( "got non-finite value when converting float to duration" ) ;
500500 }
501- if nanos > MAX_NANOS_F64 {
501+ if nanos >= MAX_NANOS_F64 {
502502 panic ! ( "overflow when converting float to duration" ) ;
503503 }
504504 if nanos < 0.0 {
@@ -525,7 +525,7 @@ impl Duration {
525525 /// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000));
526526 /// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0));
527527 /// ```
528- #[ unstable( feature = "duration_float" , issue = "0 " ) ]
528+ #[ unstable( feature = "duration_float" , issue = "54361 " ) ]
529529 #[ inline]
530530 pub fn mul_f64 ( self , rhs : f64 ) -> Duration {
531531 Duration :: from_float_secs ( rhs * self . as_float_secs ( ) )
@@ -546,7 +546,7 @@ impl Duration {
546546 /// // note that truncation is used, not rounding
547547 /// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_598));
548548 /// ```
549- #[ unstable( feature = "duration_float" , issue = "0 " ) ]
549+ #[ unstable( feature = "duration_float" , issue = "54361 " ) ]
550550 #[ inline]
551551 pub fn div_f64 ( self , rhs : f64 ) -> Duration {
552552 Duration :: from_float_secs ( self . as_float_secs ( ) / rhs)
@@ -563,7 +563,7 @@ impl Duration {
563563 /// let dur2 = Duration::new(5, 400_000_000);
564564 /// assert_eq!(dur1.div_duration(dur2), 0.5);
565565 /// ```
566- #[ unstable( feature = "duration_float" , issue = "0 " ) ]
566+ #[ unstable( feature = "duration_float" , issue = "54361 " ) ]
567567 #[ inline]
568568 pub fn div_duration ( self , rhs : Duration ) -> f64 {
569569 self . as_float_secs ( ) / rhs. as_float_secs ( )
@@ -611,7 +611,7 @@ impl Mul<u32> for Duration {
611611 }
612612}
613613
614- #[ stable( feature = "symmetric_u32_duration_mul" , since = "1.30 .0" ) ]
614+ #[ stable( feature = "symmetric_u32_duration_mul" , since = "1.31 .0" ) ]
615615impl Mul < Duration > for u32 {
616616 type Output = Duration ;
617617
0 commit comments