Skip to content

Commit 9d651d9

Browse files
committed
use time helper in more places
1 parent 82a4af2 commit 9d651d9

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

bd-logger/src/state_upload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use bd_client_stats_store::{Counter, Scope};
3737
use bd_log_primitives::LogFields;
3838
use bd_resilient_kv::SnapshotFilename;
3939
use bd_state::{RetentionHandle, RetentionRegistry};
40-
use bd_time::TimeProvider;
40+
use bd_time::{OffsetDateTimeExt, TimeProvider};
4141
use std::fs::File;
4242
use std::path::{Path, PathBuf};
4343
use std::sync::Arc;
@@ -451,7 +451,7 @@ impl StateUploadWorker {
451451

452452
let now_micros = {
453453
let now = self.time_provider.now();
454-
now.unix_timestamp().cast_unsigned() * 1_000_000 + u64::from(now.microsecond())
454+
now.unix_timestamp_micros().cast_unsigned()
455455
};
456456
let last_creation = self.last_snapshot_creation_micros.load(Ordering::Relaxed);
457457
if last_creation > 0

bd-state/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ impl Store {
542542
}
543543

544544
fn record_change(&self, timestamp: OffsetDateTime) {
545-
let micros =
546-
timestamp.unix_timestamp().cast_unsigned() * 1_000_000 + u64::from(timestamp.microsecond());
545+
let micros = timestamp.unix_timestamp_micros().cast_unsigned();
547546
self
548547
.last_change_micros
549548
.fetch_max(micros, std::sync::atomic::Ordering::Relaxed);

0 commit comments

Comments
 (0)