Skip to content

Commit

Permalink
Clarify out of range value for from_timestamp_opt
Browse files Browse the repository at this point in the history
The limits on the secs count has to be hunted down to the bottom of
the readme / root document, which is a bit annoying when
e.g. migrating from the deprecated `from_timestamp` and wondering why
`from_timestamp_opt` is fallible.

The nsecs limits can be inferred from the rest of the text but
explicit is better than implicit.
  • Loading branch information
xmo-odoo authored and djc committed Nov 16, 2022
1 parent e7eb35f commit ff9db15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/naive/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ impl NaiveDateTime {
/// in order to represent the [leap second](./struct.NaiveTime.html#leap-second-handling).
/// (The true "UNIX timestamp" cannot represent a leap second unambiguously.)
///
/// Returns `None` on the out-of-range number of seconds and/or invalid nanosecond.
/// Returns `None` on the out-of-range number of seconds (more than 262 000 years away
/// from common era) and/or invalid nanosecond (2 seconds or more).
///
/// # Example
///
Expand Down

0 comments on commit ff9db15

Please sign in to comment.