aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/api_client.rs
diff options
context:
space:
mode:
authorConrad Ludgate <conradludgate@gmail.com>2023-09-11 09:26:05 +0100
committerGitHub <noreply@github.com>2023-09-11 09:26:05 +0100
commitf90c01f702f6a98b041f766b6a1d857bc1b9afef (patch)
tree04a4755bd632abdcf398d0ce903163ed60a5a212 /atuin-client/src/api_client.rs
parentUse `case` for Linux distro choice in `install.sh` (#1200) (diff)
downloadatuin-f90c01f702f6a98b041f766b6a1d857bc1b9afef.zip
replace chrono with time (#806)
* replace chrono with time * Fix test chrono usage --------- Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Diffstat (limited to 'atuin-client/src/api_client.rs')
-rw-r--r--atuin-client/src/api_client.rs11
1 files changed, 6 insertions, 5 deletions
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<Utc>,
- history_ts: chrono::DateTime<Utc>,
+ sync_ts: OffsetDateTime,
+ history_ts: OffsetDateTime,
host: Option<String>,
) -> Result<SyncHistoryResponse> {
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,
);