mirror of
https://github.com/OMGeeky/twba_reqwest_backoff.git
synced 2025-12-26 16:27:24 +01:00
replace deprecated method
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use chrono::{DateTime, Utc};
|
||||
use reqwest::{Error, Request, Response};
|
||||
use url::Host;
|
||||
|
||||
@@ -201,8 +201,8 @@ fn get_twitch_rate_limit_value(response: &Response) -> Result<DateTime<Utc>> {
|
||||
.to_string()
|
||||
.parse::<i64>()
|
||||
.map_err(|e| ReqwestBackoffError::Other(e.into()))?;
|
||||
let timestamp = NaiveDateTime::from_timestamp_opt(timestamp, 0).ok_or(
|
||||
let timestamp: DateTime<Utc> = DateTime::from_timestamp(timestamp, 0).ok_or(
|
||||
ReqwestBackoffError::Other("Could not convert the provided timestamp".into()),
|
||||
)?;
|
||||
Ok(timestamp.and_utc())
|
||||
Ok(timestamp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user