Skip to content

Commit

Permalink
Update dep
Browse files Browse the repository at this point in the history
  • Loading branch information
james58899 committed Mar 12, 2024
1 parent f0390fa commit 7414ffa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 37 deletions.
60 changes: 30 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tikv-jemallocator = { version = "0.5", features = ["background_threads", "unpref
tikv-jemallocator = { version = "0.5", features = ["unprefixed_malloc_on_supported_platforms"] } # jemalloc not support background threads on macos

[target.'cfg(windows)'.dependencies]
tray-icon = { version = "0.11", default-features = false }
tray-icon = { version = "0.12", default-features = false }
windows = { version = "0.52", features = ["Win32_Foundation", "Win32_System_Console", "Win32_UI_WindowsAndMessaging"] }
tao = "0.26"

Expand Down
10 changes: 4 additions & 6 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
vec,
};

use chrono::{TimeZone, Utc};
use chrono::{TimeDelta, TimeZone, Utc};
use futures::{executor::block_on, TryFutureExt};
use log::{debug, error, info, warn};
use openssl::{
Expand Down Expand Up @@ -245,10 +245,8 @@ impl RPCClient {
}

pub fn get_timestemp(&self) -> i64 {
Utc::now()
.checked_add_signed(chrono::Duration::seconds(self.clock_offset.load(Ordering::Relaxed)))
.unwrap_or_else(Utc::now)
.timestamp()
let offset = TimeDelta::try_seconds(self.clock_offset.load(Ordering::Relaxed)).unwrap_or_default();
Utc::now().checked_add_signed(offset).unwrap_or_else(Utc::now).timestamp()
}

pub async fn connect_check(&self, settings: InitSettings) -> Option<()> {
Expand Down Expand Up @@ -426,7 +424,7 @@ The program will now terminate.
.send_request(url)
.await
.map_err(|_| Error::connection_error("Failed to get initial stat from server."))?;
let request_time = chrono::Duration::from_std(start_time.elapsed()).unwrap_or_else(|_| chrono::Duration::zero());
let request_time = TimeDelta::from_std(start_time.elapsed()).unwrap_or_default();
debug!("{}", body);
let res = parse_response(body.as_str());

Expand Down

0 comments on commit 7414ffa

Please sign in to comment.