diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index aa9b70bc..8f0241eb 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -20,7 +20,6 @@ use std::{ path::{Path, PathBuf}, result::Result as StdResult, sync::Arc, - time::SystemTime, }; use matrix_sdk_common::{ @@ -36,6 +35,7 @@ use matrix_sdk_common::{ AnyToDeviceEvent, EventContent, StateEvent, }, identifiers::{RoomId, UserId}, + instant::Instant, locks::RwLock, Raw, }; @@ -701,7 +701,7 @@ impl BaseClient { return Ok(SyncResponse::new(response.next_batch)); } - let now = SystemTime::now(); + let now = Instant::now(); #[cfg(feature = "encryption")] let to_device = { @@ -892,7 +892,7 @@ impl BaseClient { *self.sync_token.write().await = Some(response.next_batch.clone()); self.apply_changes(&changes).await; - info!("Processed a sync response in {:?}", now.elapsed().unwrap()); + info!("Processed a sync response in {:?}", now.elapsed()); let response = SyncResponse { next_batch: response.next_batch, diff --git a/matrix_sdk_base/src/store/memory_store.rs b/matrix_sdk_base/src/store/memory_store.rs index fa3db415..7cbcdf15 100644 --- a/matrix_sdk_base/src/store/memory_store.rs +++ b/matrix_sdk_base/src/store/memory_store.rs @@ -12,10 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{ - sync::{Arc, RwLock}, - time::SystemTime, -}; +use std::sync::{Arc, RwLock}; use dashmap::{DashMap, DashSet}; use matrix_sdk_common::{ @@ -26,6 +23,7 @@ use matrix_sdk_common::{ AnyBasicEvent, AnyStrippedStateEvent, AnySyncStateEvent, EventContent, EventType, }, identifiers::{RoomId, UserId}, + instant::Instant, }; use tracing::info; @@ -91,7 +89,7 @@ impl MemoryStore { } pub async fn save_changes(&self, changes: &StateChanges) -> Result<()> { - let now = SystemTime::now(); + let now = Instant::now(); if let Some(s) = &changes.sync_token { *self.sync_token.write().unwrap() = Some(s.to_owned());