We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e64f849 commit 27ba1c1Copy full SHA for 27ba1c1
library/core/src/time.rs
@@ -268,6 +268,11 @@ impl Duration {
268
269
/// Creates a new `Duration` from the specified number of nanoseconds.
270
///
271
+ /// Note: Using this on the return value of `as_nanos()` might cause unexpected behavior:
272
+ /// `as_nanos()` returns a u128, and can return values that do not fit in u64, e.g. 585 years.
273
+ /// Instead, consider using the pattern `Duration::new(d.as_secs(), d.subsec_nanos())`
274
+ /// if you cannot copy/clone the Duration directly.
275
+ ///
276
/// # Examples
277
278
/// ```
0 commit comments