Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MIN_TIME and MAX_TIME of NaiveTime #713

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Add support for getting week bounds based on a specific `NaiveDate` and a `Weekday` (#666)
* Remove libc dependency from Cargo.toml.
* Add the `and_local_timezone` method to `NaiveDateTime`
* Expose `MIN_TIME` and `MAX_TIME` of `NaiveTime`

## 0.4.19

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ pub use format::{ParseError, ParseResult};

pub mod naive;
#[doc(no_inline)]
pub use naive::{IsoWeek, NaiveDate, NaiveDateTime, NaiveTime, NaiveWeek};
pub use naive::{IsoWeek, NaiveDate, NaiveDateTime, NaiveTime, NaiveWeek, MAX_TIME, MIN_TIME};

pub mod offset;
#[cfg(feature = "clock")]
Expand Down
2 changes: 1 addition & 1 deletion src/naive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use self::date::{NaiveDate, NaiveWeek, MAX_DATE, MIN_DATE};
pub use self::datetime::rustc_serialize::TsSeconds;
pub use self::datetime::{NaiveDateTime, MAX_DATETIME, MIN_DATETIME};
pub use self::isoweek::IsoWeek;
pub use self::time::NaiveTime;
pub use self::time::{NaiveTime, MAX_TIME, MIN_TIME};

#[cfg(feature = "__internal_bench")]
#[doc(hidden)]
Expand Down
7 changes: 4 additions & 3 deletions src/naive/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ mod serde;
#[cfg(test)]
mod tests;

pub(super) const MIN_TIME: NaiveTime = NaiveTime { secs: 0, frac: 0 };
pub(super) const MAX_TIME: NaiveTime =
NaiveTime { secs: 23 * 3600 + 59 * 60 + 59, frac: 999_999_999 };
/// The minimum possible `NaiveTime`.
pub const MIN_TIME: NaiveTime = NaiveTime { secs: 0, frac: 0 };
/// The maximum possible `NaiveTime`.
pub const MAX_TIME: NaiveTime = NaiveTime { secs: 23 * 3600 + 59 * 60 + 59, frac: 999_999_999 };

/// ISO 8601 time without timezone.
/// Allows for the nanosecond precision and optional leap second representation.
Expand Down