Skip to content

Commit

Permalink
Rename oldtime module to duration
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Sep 7, 2023
1 parent 8f5becd commit 27ea7e9
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use core::{fmt, hash};
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};

use crate::duration::Duration as OldDuration;
#[cfg(feature = "unstable-locales")]
use crate::format::Locale;
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::format::{DelayedFormat, Item, StrftimeItems};
use crate::naive::{IsoWeek, NaiveDate, NaiveTime};
use crate::offset::{TimeZone, Utc};
use crate::oldtime::Duration as OldDuration;
use crate::DateTime;
use crate::{Datelike, Weekday};

Expand Down Expand Up @@ -576,7 +576,7 @@ where
mod tests {
use super::Date;

use crate::oldtime::Duration;
use crate::duration::Duration;
use crate::{FixedOffset, NaiveDate, Utc};

#[cfg(feature = "clock")]
Expand Down
2 changes: 1 addition & 1 deletion src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use core::{fmt, hash, str};
#[cfg(feature = "std")]
use std::time::{SystemTime, UNIX_EPOCH};

use crate::duration::Duration as OldDuration;
#[cfg(feature = "unstable-locales")]
use crate::format::Locale;
use crate::format::{
Expand All @@ -26,7 +27,6 @@ use crate::naive::{Days, IsoWeek, NaiveDate, NaiveDateTime, NaiveTime};
#[cfg(feature = "clock")]
use crate::offset::Local;
use crate::offset::{FixedOffset, Offset, TimeZone, Utc};
use crate::oldtime::Duration as OldDuration;
#[allow(deprecated)]
use crate::Date;
use crate::{Datelike, Months, Timelike, Weekday};
Expand Down
2 changes: 1 addition & 1 deletion src/datetime/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::DateTime;
use crate::duration::Duration as OldDuration;
use crate::naive::{NaiveDate, NaiveTime};
use crate::offset::{FixedOffset, TimeZone, Utc};
#[cfg(feature = "clock")]
use crate::offset::{Local, Offset};
use crate::oldtime::Duration as OldDuration;
use crate::{Datelike, Days, LocalResult, Months, NaiveDateTime, Timelike};

#[derive(Clone)]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/format/parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
//! They can be constructed incrementally while being checked for consistency.

use super::{ParseResult, IMPOSSIBLE, NOT_ENOUGH, OUT_OF_RANGE};
use crate::duration::Duration as OldDuration;
use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime};
use crate::offset::{FixedOffset, LocalResult, Offset, TimeZone};
use crate::oldtime::Duration as OldDuration;
use crate::{DateTime, Datelike, Timelike, Weekday};

/// Parsed parts of date and time. There are two classes of methods:
Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,10 @@
#[cfg(feature = "alloc")]
extern crate alloc;

mod oldtime;
// this reexport is to aid the transition and should not be in the prelude!
pub use oldtime::Duration;
mod duration;
pub use duration::Duration;
#[cfg(feature = "std")]
pub use oldtime::OutOfRangeError;
pub use duration::OutOfRangeError;

use core::fmt;

Expand Down
4 changes: 2 additions & 2 deletions src/naive/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use rkyv::{Archive, Deserialize, Serialize};
#[cfg(feature = "unstable-locales")]
use pure_rust_locales::Locale;

use crate::duration::Duration as OldDuration;
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::format::DelayedFormat;
use crate::format::{
Expand All @@ -24,7 +25,6 @@ use crate::format::{
};
use crate::month::Months;
use crate::naive::{IsoWeek, NaiveDateTime, NaiveTime};
use crate::oldtime::Duration as OldDuration;
use crate::{expect, try_opt};
use crate::{Datelike, Weekday};

Expand Down Expand Up @@ -2390,7 +2390,7 @@ mod serde {
#[cfg(test)]
mod tests {
use super::{Days, Months, NaiveDate, MAX_YEAR, MIN_YEAR};
use crate::oldtime::Duration;
use crate::duration::Duration;
use crate::{Datelike, Weekday};

// as it is hard to verify year flags in `NaiveDate::MIN` and `NaiveDate::MAX`,
Expand Down
2 changes: 1 addition & 1 deletion src/naive/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use core::{fmt, str};
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};

use crate::duration::Duration as OldDuration;
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::format::DelayedFormat;
use crate::format::{parse, parse_and_remainder, ParseError, ParseResult, Parsed, StrftimeItems};
use crate::format::{Fixed, Item, Numeric, Pad};
use crate::naive::{Days, IsoWeek, NaiveDate, NaiveTime};
use crate::offset::Utc;
use crate::oldtime::Duration as OldDuration;
use crate::{DateTime, Datelike, LocalResult, Months, TimeZone, Timelike, Weekday};

#[cfg(feature = "rustc-serialize")]
Expand Down
2 changes: 1 addition & 1 deletion src/naive/datetime/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::NaiveDateTime;
use crate::oldtime::Duration as OldDuration;
use crate::duration::Duration as OldDuration;
use crate::NaiveDate;
use crate::{Datelike, FixedOffset, Utc};

Expand Down
2 changes: 1 addition & 1 deletion src/naive/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ use core::{fmt, str};
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};

use crate::duration::Duration as OldDuration;
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::format::DelayedFormat;
use crate::format::{
parse, parse_and_remainder, write_hundreds, Fixed, Item, Numeric, Pad, ParseError, ParseResult,
Parsed, StrftimeItems,
};
use crate::oldtime::Duration as OldDuration;
use crate::Timelike;
use crate::{expect, try_opt};

Expand Down
2 changes: 1 addition & 1 deletion src/naive/time/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::NaiveTime;
use crate::oldtime::Duration as OldDuration;
use crate::duration::Duration as OldDuration;
use crate::Timelike;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/offset/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use core::str::FromStr;
use rkyv::{Archive, Deserialize, Serialize};

use super::{LocalResult, Offset, TimeZone};
use crate::duration::Duration as OldDuration;
use crate::format::{scan, OUT_OF_RANGE};
use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime};
use crate::oldtime::Duration as OldDuration;
use crate::{DateTime, ParseError, Timelike};

/// The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59.
Expand Down
2 changes: 1 addition & 1 deletion src/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See README.md and LICENSE.txt for details.

use crate::datetime::DateTime;
use crate::oldtime::Duration;
use crate::duration::Duration;
use crate::NaiveDateTime;
use crate::TimeZone;
use crate::Timelike;
Expand Down

0 comments on commit 27ea7e9

Please sign in to comment.