Switched from time to chrono.
This commit is contained in:
parent
f0fa03e70a
commit
ccefda229b
5 changed files with 10 additions and 10 deletions
|
@ -18,11 +18,11 @@ nochanlists = []
|
|||
[dependencies]
|
||||
bufstream = "0.1"
|
||||
bytes = "0.4"
|
||||
chrono = "0.4"
|
||||
encoding = "0.2"
|
||||
error-chain = "0.10"
|
||||
futures = "0.1"
|
||||
native-tls = "0.1"
|
||||
time = "0.1"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -6,13 +6,13 @@ use std::path::Path;
|
|||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::thread;
|
||||
|
||||
#[cfg(feature = "ctcp")]
|
||||
use chrono::prelude::*;
|
||||
use futures::{Async, Poll, Future, Sink, Stream};
|
||||
use futures::stream::SplitStream;
|
||||
use futures::sync::mpsc;
|
||||
use futures::sync::oneshot;
|
||||
use futures::sync::mpsc::UnboundedSender;
|
||||
#[cfg(feature = "ctcp")]
|
||||
use time;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
use error;
|
||||
|
@ -438,7 +438,7 @@ impl ServerState {
|
|||
} else if tokens[0].eq_ignore_ascii_case("PING") && tokens.len() > 1 {
|
||||
self.send_ctcp_internal(resp, &format!("PING {}", tokens[1]))
|
||||
} else if tokens[0].eq_ignore_ascii_case("TIME") {
|
||||
self.send_ctcp_internal(resp, &format!("TIME :{}", time::now().rfc822z()))
|
||||
self.send_ctcp_internal(resp, &format!("TIME :{}", Local::now().to_rfc2822()))
|
||||
} else if tokens[0].eq_ignore_ascii_case("USERINFO") {
|
||||
self.send_ctcp_internal(resp, &format!("USERINFO :{}", self.config().user_info()))
|
||||
} else {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[cfg(feature = "ctcp")]
|
||||
use time;
|
||||
use chrono::prelude::*;
|
||||
|
||||
use error::Result;
|
||||
use proto::{Capability, Command, Mode, NegotiationVersion};
|
||||
|
@ -325,8 +325,8 @@ pub trait ServerExt: Server {
|
|||
where
|
||||
Self: Sized,
|
||||
{
|
||||
let time = time::get_time();
|
||||
self.send_ctcp(target, &format!("PING {}.{}", time.sec, time.nsec)[..])
|
||||
let time = Local::now();
|
||||
self.send_ctcp(target, &format!("PING {}", time.timestamp())[..])
|
||||
}
|
||||
|
||||
/// Sends a time request to the specified target.
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock, RwLockReadGuard};
|
|||
use std::time::{Duration, Instant};
|
||||
|
||||
use futures::{Async, Poll, Sink, StartSend, Stream};
|
||||
use time;
|
||||
use chrono::prelude::*;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio_io::codec::Framed;
|
||||
use tokio_timer;
|
||||
|
@ -59,7 +59,7 @@ where
|
|||
|
||||
fn send_ping(&mut self) -> error::Result<()> {
|
||||
self.last_ping_sent = Instant::now();
|
||||
self.last_ping_data = format!("{}", time::now().to_timespec().sec);
|
||||
self.last_ping_data = format!("{}", Local::now().timestamp());
|
||||
let data = self.last_ping_data.clone();
|
||||
let result = self.start_send(Command::PING(data, None).into())?;
|
||||
assert!(result.is_ready());
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
extern crate bufstream;
|
||||
extern crate bytes;
|
||||
extern crate chrono;
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
extern crate encoding;
|
||||
|
@ -15,7 +16,6 @@ extern crate serde;
|
|||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate time;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_io;
|
||||
extern crate tokio_mockstream;
|
||||
|
|
Loading…
Reference in a new issue