Skip to content

Commit

Permalink
Remove deprecated use of DateTime::from_utc
Browse files Browse the repository at this point in the history
  • Loading branch information
inahga committed Sep 12, 2023
1 parent 73f88a7 commit f7f652d
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions collector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))]

use backoff::{backoff::Backoff, ExponentialBackoff};
use chrono::{DateTime, Duration, Utc};
use chrono::{DateTime, Duration, TimeZone, Utc};
use derivative::Derivative;
use http_api_problem::HttpApiProblem;
pub use janus_core::task::AuthenticationToken;
Expand Down Expand Up @@ -551,10 +551,7 @@ impl<V: vdaf::Collector> Collector<V> {
partial_batch_selector: collect_response.partial_batch_selector().clone(),
report_count: collect_response.report_count(),
interval: (
DateTime::<Utc>::from_utc(
collect_response.interval().start().as_naive_date_time()?,
Utc,
),
Utc.from_utc_datetime(&collect_response.interval().start().as_naive_date_time()?),
collect_response
.interval()
.duration()
Expand Down Expand Up @@ -664,7 +661,7 @@ mod tests {
PollResult,
};
use assert_matches::assert_matches;
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
use chrono::{NaiveDateTime, TimeZone, Utc};
#[cfg(feature = "fpvec_bounded_l2")]
use fixed_macro::fixed;
use janus_core::{
Expand Down Expand Up @@ -915,9 +912,8 @@ mod tests {
PartialBatchSelector::new_time_interval(),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
Utc
Utc.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
),
chrono::Duration::seconds(3600),
),
Expand Down Expand Up @@ -984,9 +980,8 @@ mod tests {
PartialBatchSelector::new_time_interval(),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
Utc
Utc.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
),
chrono::Duration::seconds(3600),
),
Expand Down Expand Up @@ -1052,9 +1047,8 @@ mod tests {
PartialBatchSelector::new_time_interval(),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
Utc
Utc.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
),
chrono::Duration::seconds(3600),
),
Expand Down Expand Up @@ -1129,9 +1123,8 @@ mod tests {
PartialBatchSelector::new_time_interval(),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
Utc
Utc.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
),
chrono::Duration::seconds(3600),
),
Expand Down Expand Up @@ -1199,10 +1192,7 @@ mod tests {
PartialBatchSelector::new_fixed_size(batch_id),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(0, 0).unwrap(),
Utc
),
Utc.from_utc_datetime(&NaiveDateTime::from_timestamp_opt(0, 0).unwrap()),
chrono::Duration::seconds(1),
),
1
Expand Down Expand Up @@ -1280,9 +1270,8 @@ mod tests {
PartialBatchSelector::new_time_interval(),
1,
(
DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
Utc
Utc.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(1_000_000, 0).unwrap(),
),
chrono::Duration::seconds(3600),
),
Expand Down

0 comments on commit f7f652d

Please sign in to comment.