From 446b920d9664b7b144366fd38e31799a69c867cf Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 9 May 2020 08:07:31 +0900 Subject: [PATCH] Replace deprecated methods with `now_utc()` --- actix-redis/src/session.rs | 4 ++-- actix-session/src/cookie.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/actix-redis/src/session.rs b/actix-redis/src/session.rs index 394370aa3..8502373c8 100644 --- a/actix-redis/src/session.rs +++ b/actix-redis/src/session.rs @@ -360,7 +360,7 @@ impl Inner { let mut cookie = Cookie::named(self.name.clone()); cookie.set_value(""); cookie.set_max_age(Duration::zero()); - cookie.set_expires(OffsetDateTime::now() - Duration::days(365)); + cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365)); let val = HeaderValue::from_str(&cookie.to_string()) .map_err(error::ErrorInternalServerError)?; @@ -638,7 +638,7 @@ mod test { .find(|c| c.name() == "test-session") .unwrap(); assert_ne!( - OffsetDateTime::now().year(), + OffsetDateTime::now_utc().year(), cookie_4.expires().map(|t| t.year()).unwrap() ); diff --git a/actix-session/src/cookie.rs b/actix-session/src/cookie.rs index 1acf41076..1a78fad2e 100644 --- a/actix-session/src/cookie.rs +++ b/actix-session/src/cookie.rs @@ -100,7 +100,7 @@ impl CookieSessionInner { } if let Some(expires_in) = self.expires_in { - cookie.set_expires(OffsetDateTime::now() + expires_in); + cookie.set_expires(OffsetDateTime::now_utc() + expires_in); } if let Some(max_age) = self.max_age { @@ -131,7 +131,7 @@ impl CookieSessionInner { let mut cookie = Cookie::named(self.name.clone()); cookie.set_value(""); cookie.set_max_age(Duration::zero()); - cookie.set_expires(OffsetDateTime::now() - Duration::days(365)); + cookie.set_expires(OffsetDateTime::now_utc() - Duration::days(365)); let val = HeaderValue::from_str(&cookie.to_string())?; res.headers_mut().append(SET_COOKIE, val);