Replace time with std::time

This commit is contained in:
Demur Rumed 2016-07-17 04:02:57 +00:00
parent 93f103bdb5
commit 5dda3e2602
3 changed files with 5 additions and 4 deletions

View File

@ -31,7 +31,6 @@ rustc-serialize = "0.3"
secp256k1 = "0.5" secp256k1 = "0.5"
serde = "0.6" serde = "0.6"
strason = "0.3" strason = "0.3"
time = "0.1"
[dependencies.jsonrpc] [dependencies.jsonrpc]
version = "0.7" # for serde macros version = "0.7" # for serde macros

View File

@ -52,7 +52,6 @@ extern crate secp256k1;
extern crate serde; extern crate serde;
extern crate strason; extern crate strason;
#[cfg(all(test, feature = "unstable"))] extern crate test; #[cfg(all(test, feature = "unstable"))] extern crate test;
extern crate time;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]

View File

@ -17,7 +17,7 @@
//! This module provides support for low-level network communication. //! This module provides support for low-level network communication.
//! //!
use time::now; use std::time::{UNIX_EPOCH, SystemTime};
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use std::io::{self, Write}; use std::io::{self, Write};
use std::net; use std::net;
@ -146,7 +146,10 @@ impl Socket {
pub fn version_message(&mut self, start_height: i32) -> Result<NetworkMessage, util::Error> { pub fn version_message(&mut self, start_height: i32) -> Result<NetworkMessage, util::Error> {
let recv_addr = try!(self.receiver_address()); let recv_addr = try!(self.receiver_address());
let send_addr = try!(self.sender_address()); let send_addr = try!(self.sender_address());
let timestamp = now().to_timespec().sec; let timestamp = match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(dur) => dur,
Err(err) => err.duration(),
}.as_secs() as i64;
Ok(Version(VersionMessage { Ok(Version(VersionMessage {
version: constants::PROTOCOL_VERSION, version: constants::PROTOCOL_VERSION,