diff options
| author | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
| commit | c846e929a88837094d7a5383a306df1fec56c333 (patch) | |
| tree | 48ab058d58c090ff00199af6b3eef7d64c7c2c95 /src/timestamp.rs | |
| parent | b80036ef629e0803f3a70059a8fa12d1a2ae3b2d (diff) | |
more specific types!
Diffstat (limited to 'src/timestamp.rs')
| -rw-r--r-- | src/timestamp.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/timestamp.rs b/src/timestamp.rs new file mode 100644 index 0000000..645fb0d --- /dev/null +++ b/src/timestamp.rs @@ -0,0 +1,19 @@ + +use std::ops::{Add, Sub}; + +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct Timestamp(pub i64); + +impl Add<i64> for Timestamp { + type Output = Self; + fn add(self, other: i64) -> Self { + Self(self.0 + other) + } +} + +impl Sub<i64> for Timestamp { + type Output = Self; + fn sub(self, other: i64) -> Self { + Self(self.0 - other) + } +} |
