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]
hyper = "0.9"
time = "0.1"
url = "1.1"
[dependencies.clippy]

View file

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