aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake McGinty <me@jake.su>2018-02-23 15:02:36 +0000
committerJake McGinty <me@jake.su>2018-02-23 15:02:36 +0000
commitcd0cda8ec96ebc434fda0ca520da834655535a5e (patch)
treef0891da64fb047870132230a631bf1885929ccca
parentfinish up supporting the whole config protocol (diff)
downloadwireguard-rs-cd0cda8ec96ebc434fda0ca520da834655535a5e.tar.xz
wireguard-rs-cd0cda8ec96ebc434fda0ca520da834655535a5e.zip
use std::time instead of time crate
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs1
-rw-r--r--src/tai64n.rs8
4 files changed, 4 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2619e75..821d126 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1133,7 +1133,6 @@ dependencies = [
"structopt 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 9ab64c0..596ced2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,7 +46,6 @@ pnet_packet = "^0.20"
snow = { git = "https://github.com/mcginty/snow", features = ["ring-accelerated"], branch = "wireguard" }
socket2 = "^0.3"
subtle = "^0.5"
-time = "^0.1"
tokio-io = "^0.1"
tokio-core = "^0.1"
tokio-uds = "^0.1"
diff --git a/src/lib.rs b/src/lib.rs
index a336fb6..14f8890 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,7 +25,6 @@ extern crate snow;
extern crate socket2;
extern crate subtle;
extern crate test;
-extern crate time;
extern crate tokio_core;
extern crate tokio_io;
extern crate tokio_uds;
diff --git a/src/tai64n.rs b/src/tai64n.rs
index bfb4a78..9e15ed1 100644
--- a/src/tai64n.rs
+++ b/src/tai64n.rs
@@ -1,6 +1,6 @@
use byteorder::{ByteOrder, BigEndian};
use std::ops::Deref;
-use time;
+use std::time::{SystemTime, UNIX_EPOCH};
const TAI64N_BASE: i64 = 4611686018427387914;
@@ -12,9 +12,9 @@ pub struct TAI64N {
impl TAI64N {
pub fn now() -> TAI64N {
let mut tai64n = [0u8; 12];
- let now = time::get_time();
- BigEndian::write_i64(&mut tai64n[0..], TAI64N_BASE + now.sec);
- BigEndian::write_i32(&mut tai64n[8..], now.nsec);
+ let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
+ BigEndian::write_i64(&mut tai64n[0..], TAI64N_BASE + now.as_secs() as i64);
+ BigEndian::write_i32(&mut tai64n[8..], (now.subsec_nanos() as i32));
TAI64N { tai64n }
}