deps: update chrono to 0.4

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko
2018-07-25 22:44:32 +02:00
parent 35fc95b066
commit e634d3f139
6 changed files with 17 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
use chrono::{DateTime, UTC, TimeZone};
use chrono::{DateTime, Utc, TimeZone};
use std::error::Error;
use std::fmt;
use std::str::FromStr;
@@ -203,12 +203,12 @@ impl Token {
if self.access_token.len() == 0 {
panic!("called expired() on unset token");
}
self.expiry_date() <= UTC::now()
self.expiry_date() <= Utc::now()
}
/// Returns a DateTime object representing our expiry date.
pub fn expiry_date(&self) -> DateTime<UTC> {
UTC.timestamp(self.expires_in_timestamp
pub fn expiry_date(&self) -> DateTime<Utc> {
Utc.timestamp(self.expires_in_timestamp
.expect("Tokens without an absolute expiry are invalid"),
0)
}
@@ -220,7 +220,7 @@ impl Token {
return self;
}
self.expires_in_timestamp = Some(UTC::now().timestamp() + self.expires_in.unwrap());
self.expires_in_timestamp = Some(Utc::now().timestamp() + self.expires_in.unwrap());
self.expires_in = None;
self
}