Skip to content

Commit 6cbb695

Browse files
authored
Change type of timestamp-variants to u128 (#50)
1 parent cba862d commit 6cbb695

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/query/consts.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pub const MINUTES_PER_HOUR: usize = 60;
2-
pub const SECONDS_PER_MINUTE: usize = 60;
3-
pub const MILLIS_PER_SECOND: usize = 1000;
4-
pub const NANOS_PER_MILLI: usize = 1_000_000;
1+
pub const MINUTES_PER_HOUR: u128 = 60;
2+
pub const SECONDS_PER_MINUTE: u128 = 60;
3+
pub const MILLIS_PER_SECOND: u128 = 1000;
4+
pub const NANOS_PER_MILLI: u128 = 1_000_000;
55

66
#[cfg(test)]
7-
pub const MICROS_PER_NANO: usize = 1000;
7+
pub const MICROS_PER_NANO: u128 = 1000;

src/query/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ use consts::{MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MILLI, SECONDS_PER_M
4141
#[derive(PartialEq, Debug, Copy, Clone)]
4242
pub enum Timestamp {
4343
Now,
44-
Nanoseconds(usize),
45-
Microseconds(usize),
46-
Milliseconds(usize),
47-
Seconds(usize),
48-
Minutes(usize),
49-
Hours(usize),
44+
Nanoseconds(u128),
45+
Microseconds(u128),
46+
Milliseconds(u128),
47+
Seconds(u128),
48+
Minutes(u128),
49+
Hours(u128),
5050
}
5151

5252
impl fmt::Display for Timestamp {
@@ -97,7 +97,7 @@ where
9797
T: TimeZone,
9898
{
9999
fn from(date_time: DateTime<T>) -> Self {
100-
Timestamp::Nanoseconds(date_time.timestamp_nanos() as usize)
100+
Timestamp::Nanoseconds(date_time.timestamp_nanos() as u128)
101101
}
102102
}
103103

0 commit comments

Comments
 (0)