diff options
author | Jake McGinty <me@jake.su> | 2018-02-23 15:02:36 +0000 |
---|---|---|
committer | Jake McGinty <me@jake.su> | 2018-02-23 15:02:36 +0000 |
commit | cd0cda8ec96ebc434fda0ca520da834655535a5e (patch) | |
tree | f0891da64fb047870132230a631bf1885929ccca | |
parent | finish up supporting the whole config protocol (diff) | |
download | wireguard-rs-cd0cda8ec96ebc434fda0ca520da834655535a5e.tar.xz wireguard-rs-cd0cda8ec96ebc434fda0ca520da834655535a5e.zip |
use std::time instead of time crate
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/tai64n.rs | 8 |
4 files changed, 4 insertions, 7 deletions
@@ -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)", @@ -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" @@ -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 } } |