aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sys/unix/time.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ctr-std/src/sys/unix/time.rs')
-rw-r--r--ctr-std/src/sys/unix/time.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/ctr-std/src/sys/unix/time.rs b/ctr-std/src/sys/unix/time.rs
index 3bc1dca..d5dcbc4 100644
--- a/ctr-std/src/sys/unix/time.rs
+++ b/ctr-std/src/sys/unix/time.rs
@@ -11,6 +11,7 @@
use cmp::Ordering;
use libc;
use time::Duration;
+use core::hash::{Hash, Hasher};
pub use self::inner::{Instant, SystemTime, UNIX_EPOCH};
@@ -103,6 +104,13 @@ impl Ord for Timespec {
}
}
+impl Hash for Timespec {
+ fn hash<H : Hasher>(&self, state: &mut H) {
+ self.t.tv_sec.hash(state);
+ self.t.tv_nsec.hash(state);
+ }
+}
+
mod inner {
use fmt;
use libc;
@@ -116,12 +124,12 @@ mod inner {
use libctru;
- #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
+ #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub struct Instant {
t: u64
}
- #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SystemTime {
t: Timespec,
}