@@ -52,6 +52,7 @@ impl Duration {
52
52
/// If the nanoseconds is greater than 1 billion (the number of nanoseconds
53
53
/// in a second), then it will carry over into the seconds provided.
54
54
#[ stable( feature = "duration" , since = "1.3.0" ) ]
55
+ #[ inline]
55
56
pub fn new ( secs : u64 , nanos : u32 ) -> Duration {
56
57
let secs = secs + ( nanos / NANOS_PER_SEC ) as u64 ;
57
58
let nanos = nanos % NANOS_PER_SEC ;
@@ -60,12 +61,14 @@ impl Duration {
60
61
61
62
/// Creates a new `Duration` from the specified number of seconds.
62
63
#[ stable( feature = "duration" , since = "1.3.0" ) ]
64
+ #[ inline]
63
65
pub fn from_secs ( secs : u64 ) -> Duration {
64
66
Duration { secs : secs, nanos : 0 }
65
67
}
66
68
67
69
/// Creates a new `Duration` from the specified number of milliseconds.
68
70
#[ stable( feature = "duration" , since = "1.3.0" ) ]
71
+ #[ inline]
69
72
pub fn from_millis ( millis : u64 ) -> Duration {
70
73
let secs = millis / MILLIS_PER_SEC ;
71
74
let nanos = ( ( millis % MILLIS_PER_SEC ) as u32 ) * NANOS_PER_MILLI ;
@@ -77,6 +80,7 @@ impl Duration {
77
80
/// The extra precision represented by this duration is ignored (e.g. extra
78
81
/// nanoseconds are not represented in the returned value).
79
82
#[ stable( feature = "duration" , since = "1.3.0" ) ]
83
+ #[ inline]
80
84
pub fn as_secs ( & self ) -> u64 { self . secs }
81
85
82
86
/// Returns the nanosecond precision represented by this duration.
@@ -85,6 +89,7 @@ impl Duration {
85
89
/// represented by nanoseconds. The returned number always represents a
86
90
/// fractional portion of a second (e.g. it is less than one billion).
87
91
#[ stable( feature = "duration" , since = "1.3.0" ) ]
92
+ #[ inline]
88
93
pub fn subsec_nanos ( & self ) -> u32 { self . nanos }
89
94
}
90
95
0 commit comments