Skip to content

Commit

Permalink
Change type of timestamp-variants to u128 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-kr authored Feb 16, 2020
1 parent cba862d commit 6cbb695
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/query/consts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub const MINUTES_PER_HOUR: usize = 60;
pub const SECONDS_PER_MINUTE: usize = 60;
pub const MILLIS_PER_SECOND: usize = 1000;
pub const NANOS_PER_MILLI: usize = 1_000_000;
pub const MINUTES_PER_HOUR: u128 = 60;
pub const SECONDS_PER_MINUTE: u128 = 60;
pub const MILLIS_PER_SECOND: u128 = 1000;
pub const NANOS_PER_MILLI: u128 = 1_000_000;

#[cfg(test)]
pub const MICROS_PER_NANO: usize = 1000;
pub const MICROS_PER_NANO: u128 = 1000;
14 changes: 7 additions & 7 deletions src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ use consts::{MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MILLI, SECONDS_PER_M
#[derive(PartialEq, Debug, Copy, Clone)]
pub enum Timestamp {
Now,
Nanoseconds(usize),
Microseconds(usize),
Milliseconds(usize),
Seconds(usize),
Minutes(usize),
Hours(usize),
Nanoseconds(u128),
Microseconds(u128),
Milliseconds(u128),
Seconds(u128),
Minutes(u128),
Hours(u128),
}

impl fmt::Display for Timestamp {
Expand Down Expand Up @@ -97,7 +97,7 @@ where
T: TimeZone,
{
fn from(date_time: DateTime<T>) -> Self {
Timestamp::Nanoseconds(date_time.timestamp_nanos() as usize)
Timestamp::Nanoseconds(date_time.timestamp_nanos() as u128)
}
}

Expand Down

0 comments on commit 6cbb695

Please sign in to comment.