Skip to content

Commit

Permalink
Add tests for negative timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
quodlibetor committed Jun 13, 2018
1 parent 0ef8c5c commit 4253bc6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/naive/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ impl NaiveDateTime {
///
/// let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms(1, 46, 40);
/// assert_eq!(dt.timestamp(), 1_000_000_000);
///
/// let dt = NaiveDate::from_ymd(1969, 12, 31).and_hms(11, 59, 59);
/// assert_eq!(dt.timestamp_millis(), -1);
/// ~~~~
#[inline]
pub fn timestamp(&self) -> i64 {
Expand Down Expand Up @@ -283,6 +286,9 @@ impl NaiveDateTime {
///
/// let dt = NaiveDate::from_ymd(2001, 9, 9).and_hms_milli(1, 46, 40, 555);
/// assert_eq!(dt.timestamp_millis(), 1_000_000_000_555);
///
/// let dt = NaiveDate::from_ymd(1969, 12, 31).and_hms_milli(11, 59, 59, 100);
/// assert_eq!(dt.timestamp_millis(), -900);
/// ~~~~
#[inline]
pub fn timestamp_millis(&self) -> i64 {
Expand Down

0 comments on commit 4253bc6

Please sign in to comment.