Replace deprecated 'OffsetDateTime::now' with 'OffsetDateTime::now_utc'.

Update 'time' dependency accordingly.
This commit is contained in:
Yusuke Kominami 2020-05-27 13:37:30 +09:00 committed by Jeb Rosen
parent ea81f8e07b
commit a21221aeb6
4 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ private-cookies = ["cookie/secure"]
smallvec = "1.0" smallvec = "1.0"
percent-encoding = "1" percent-encoding = "1"
hyper = { version = "0.10.13", default-features = false } hyper = { version = "0.10.13", default-features = false }
time = "0.2.9" time = "0.2.11"
indexmap = "1.0" indexmap = "1.0"
rustls = { version = "0.16", optional = true } rustls = { version = "0.16", optional = true }
state = "0.4" state = "0.4"

View File

@ -373,7 +373,7 @@ impl Cookies<'_> {
} }
if cookie.expires().is_none() { if cookie.expires().is_none() {
cookie.set_expires(time::OffsetDateTime::now() + time::Duration::weeks(1)); cookie.set_expires(time::OffsetDateTime::now_utc() + time::Duration::weeks(1));
} }
if cookie.same_site().is_none() { if cookie.same_site().is_none() {

View File

@ -31,7 +31,7 @@ log = "0.4"
toml = "0.4.7" toml = "0.4.7"
num_cpus = "1.0" num_cpus = "1.0"
state = "0.4.1" state = "0.4.1"
time = "0.2.9" time = "0.2.11"
memchr = "2" # TODO: Use pear instead. memchr = "2" # TODO: Use pear instead.
binascii = "0.1" binascii = "0.1"
pear = "0.1" pear = "0.1"

View File

@ -414,7 +414,7 @@ impl<'c> LocalRequest<'c> {
// with the changes reflected by `response`. // with the changes reflected by `response`.
if let Some(ref jar) = client.cookies { if let Some(ref jar) = client.cookies {
let mut jar = jar.write().expect("LocalRequest::_dispatch() write lock"); let mut jar = jar.write().expect("LocalRequest::_dispatch() write lock");
let current_time = time::OffsetDateTime::now(); let current_time = time::OffsetDateTime::now_utc();
for cookie in response.cookies() { for cookie in response.cookies() {
if let Some(expires) = cookie.expires() { if let Some(expires) = cookie.expires() {
if expires <= current_time { if expires <= current_time {