From f90c01f702f6a98b041f766b6a1d857bc1b9afef Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Mon, 11 Sep 2023 09:26:05 +0100 Subject: replace chrono with time (#806) * replace chrono with time * Fix test chrono usage --------- Co-authored-by: Ellie Huxtable --- atuin-client/src/api_client.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'atuin-client/src/api_client.rs') diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs index 5ae1ed0a..d2ca339f 100644 --- a/atuin-client/src/api_client.rs +++ b/atuin-client/src/api_client.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use std::env; -use chrono::Utc; use eyre::{bail, Result}; use reqwest::{ header::{HeaderMap, AUTHORIZATION, USER_AGENT}, @@ -17,6 +16,8 @@ use atuin_common::{ record::RecordIndex, }; use semver::Version; +use time::format_description::well_known::Rfc3339; +use time::OffsetDateTime; use crate::{history::History, sync::hash_str}; @@ -150,8 +151,8 @@ impl<'a> Client<'a> { pub async fn get_history( &self, - sync_ts: chrono::DateTime, - history_ts: chrono::DateTime, + sync_ts: OffsetDateTime, + history_ts: OffsetDateTime, host: Option, ) -> Result { let host = host.unwrap_or_else(|| { @@ -165,8 +166,8 @@ impl<'a> Client<'a> { let url = format!( "{}/sync/history?sync_ts={}&history_ts={}&host={}", self.sync_addr, - urlencoding::encode(sync_ts.to_rfc3339().as_str()), - urlencoding::encode(history_ts.to_rfc3339().as_str()), + urlencoding::encode(sync_ts.format(&Rfc3339)?.as_str()), + urlencoding::encode(history_ts.format(&Rfc3339)?.as_str()), host, ); -- cgit v1.3.1