Use std::time instead of deprecated crate time

This commit is contained in:
Laurent Arnoud 2016-08-20 20:21:33 +02:00
parent f43b2eb28e
commit e3663eb257
No known key found for this signature in database
GPG key ID: A79DAB2374F95DD5
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.