From d9bf08f20a1539899b55e89a0c2caf3868eda58e Mon Sep 17 00:00:00 2001 From: Macpie Date: Tue, 6 May 2025 11:03:10 -0700 Subject: [PATCH] Update UsageStatsReqV1 timestamp to ms --- file_store/src/usage_counts.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/file_store/src/usage_counts.rs b/file_store/src/usage_counts.rs index c6f78822c..c96c52db2 100644 --- a/file_store/src/usage_counts.rs +++ b/file_store/src/usage_counts.rs @@ -52,25 +52,25 @@ impl MsgDecode for RadioUsageStatsReq { impl MsgTimestamp>> for HexUsageStatsReqV1 { fn timestamp(&self) -> Result> { - self.timestamp.to_timestamp() + self.timestamp.to_timestamp_millis() } } impl MsgTimestamp for HexUsageStatsReq { fn timestamp(&self) -> u64 { - self.timestamp.encode_timestamp() + self.timestamp.encode_timestamp_millis() } } impl MsgTimestamp>> for RadioUsageStatsReqV1 { fn timestamp(&self) -> Result> { - self.timestamp.to_timestamp() + self.timestamp.to_timestamp_millis() } } impl MsgTimestamp for RadioUsageStatsReq { fn timestamp(&self) -> u64 { - self.timestamp.encode_timestamp() + self.timestamp.encode_timestamp_millis() } } @@ -78,8 +78,8 @@ impl TryFrom for HexUsageStatsReq { type Error = Error; fn try_from(v: HexUsageStatsReqV1) -> Result { let timestamp = v.timestamp()?; - let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp()?; - let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp()?; + let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp_millis()?; + let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp_millis()?; let hex = CellIndex::try_from(v.hex).map_err(|_| { DecodeError::FileStreamTryDecode(format!("invalid CellIndex {}", v.hex)) })?; @@ -101,8 +101,8 @@ impl TryFrom for HexUsageStatsReq { impl From for HexUsageStatsReqV1 { fn from(v: HexUsageStatsReq) -> Self { let timestamp = v.timestamp(); - let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp(); - let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp(); + let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp_millis(); + let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp_millis(); HexUsageStatsReqV1 { hex: v.hex.into(), @@ -124,8 +124,8 @@ impl TryFrom for RadioUsageStatsReq { type Error = Error; fn try_from(v: RadioUsageStatsReqV1) -> Result { let timestamp = v.timestamp()?; - let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp()?; - let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp()?; + let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp_millis()?; + let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp_millis()?; Ok(Self { hotspot_pubkey: v.hotspot_pubkey.into(), service_provider_user_count: v.service_provider_user_count, @@ -144,8 +144,8 @@ impl TryFrom for RadioUsageStatsReq { impl From for RadioUsageStatsReqV1 { fn from(v: RadioUsageStatsReq) -> Self { let timestamp = v.timestamp(); - let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp(); - let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp(); + let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp_millis(); + let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp_millis(); RadioUsageStatsReqV1 { hotspot_pubkey: v.hotspot_pubkey.into(),