Merge pull request #5 from spk/remove-crate-time

Use std::time instead of deprecated crate time
This commit is contained in:
messense 2016-08-21 10:13:51 +08:00 committed by GitHub
commit e501f4c3b9
2 changed files with 3 additions and 6 deletions

View file

@ -12,7 +12,6 @@ version = "0.4.4"
[dependencies] [dependencies]
hyper = "0.9" hyper = "0.9"
time = "0.1"
url = "1.1" url = "1.1"
[dependencies.clippy] [dependencies.clippy]

View file

@ -34,7 +34,6 @@
#![cfg_attr(feature="clippy", warn(cyclomatic_complexity))] #![cfg_attr(feature="clippy", warn(cyclomatic_complexity))]
extern crate url; extern crate url;
extern crate time;
extern crate hyper; extern crate hyper;
use std::io::Read; use std::io::Read;
@ -44,7 +43,7 @@ use url::Url;
use hyper::{Client}; use hyper::{Client};
use hyper::header::{UserAgent}; use hyper::header::{UserAgent};
use hyper::status::StatusCode; use hyper::status::StatusCode;
use std::time::Duration; use std::time::{Duration, SystemTime, UNIX_EPOCH};
const USER_AGENT: &'static str = "robotparser-rs (https://crates.io/crates/robotparser)"; const USER_AGENT: &'static str = "robotparser-rs (https://crates.io/crates/robotparser)";
@ -214,9 +213,8 @@ impl<'a> RobotFileParser<'a> {
/// Sets the time the robots.txt file was last fetched to the /// Sets the time the robots.txt file was last fetched to the
/// current time. /// current time.
pub fn modified(&self) { pub fn modified(&self) {
use time::get_time; let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() as i64;
self.last_checked.set(now);
self.last_checked.set(get_time().sec);
} }
/// Sets the URL referring to a robots.txt file. /// Sets the URL referring to a robots.txt file.