Skip to content

Commit f378abe

Browse files
authored
Update UsageStatsReqV1 timestamp to ms (#998)
1 parent 3bb09df commit f378abe

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

file_store/src/usage_counts.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,34 @@ impl MsgDecode for RadioUsageStatsReq {
5252

5353
impl MsgTimestamp<Result<DateTime<Utc>>> for HexUsageStatsReqV1 {
5454
fn timestamp(&self) -> Result<DateTime<Utc>> {
55-
self.timestamp.to_timestamp()
55+
self.timestamp.to_timestamp_millis()
5656
}
5757
}
5858

5959
impl MsgTimestamp<u64> for HexUsageStatsReq {
6060
fn timestamp(&self) -> u64 {
61-
self.timestamp.encode_timestamp()
61+
self.timestamp.encode_timestamp_millis()
6262
}
6363
}
6464

6565
impl MsgTimestamp<Result<DateTime<Utc>>> for RadioUsageStatsReqV1 {
6666
fn timestamp(&self) -> Result<DateTime<Utc>> {
67-
self.timestamp.to_timestamp()
67+
self.timestamp.to_timestamp_millis()
6868
}
6969
}
7070

7171
impl MsgTimestamp<u64> for RadioUsageStatsReq {
7272
fn timestamp(&self) -> u64 {
73-
self.timestamp.encode_timestamp()
73+
self.timestamp.encode_timestamp_millis()
7474
}
7575
}
7676

7777
impl TryFrom<HexUsageStatsReqV1> for HexUsageStatsReq {
7878
type Error = Error;
7979
fn try_from(v: HexUsageStatsReqV1) -> Result<Self> {
8080
let timestamp = v.timestamp()?;
81-
let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp()?;
82-
let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp()?;
81+
let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp_millis()?;
82+
let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp_millis()?;
8383
let hex = CellIndex::try_from(v.hex).map_err(|_| {
8484
DecodeError::FileStreamTryDecode(format!("invalid CellIndex {}", v.hex))
8585
})?;
@@ -101,8 +101,8 @@ impl TryFrom<HexUsageStatsReqV1> for HexUsageStatsReq {
101101
impl From<HexUsageStatsReq> for HexUsageStatsReqV1 {
102102
fn from(v: HexUsageStatsReq) -> Self {
103103
let timestamp = v.timestamp();
104-
let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp();
105-
let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp();
104+
let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp_millis();
105+
let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp_millis();
106106

107107
HexUsageStatsReqV1 {
108108
hex: v.hex.into(),
@@ -124,8 +124,8 @@ impl TryFrom<RadioUsageStatsReqV1> for RadioUsageStatsReq {
124124
type Error = Error;
125125
fn try_from(v: RadioUsageStatsReqV1) -> Result<Self> {
126126
let timestamp = v.timestamp()?;
127-
let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp()?;
128-
let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp()?;
127+
let epoch_start_timestamp = v.epoch_start_timestamp.to_timestamp_millis()?;
128+
let epoch_end_timestamp = v.epoch_end_timestamp.to_timestamp_millis()?;
129129
Ok(Self {
130130
hotspot_pubkey: v.hotspot_pubkey.into(),
131131
service_provider_user_count: v.service_provider_user_count,
@@ -144,8 +144,8 @@ impl TryFrom<RadioUsageStatsReqV1> for RadioUsageStatsReq {
144144
impl From<RadioUsageStatsReq> for RadioUsageStatsReqV1 {
145145
fn from(v: RadioUsageStatsReq) -> Self {
146146
let timestamp = v.timestamp();
147-
let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp();
148-
let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp();
147+
let epoch_start_timestamp = v.epoch_start_timestamp.encode_timestamp_millis();
148+
let epoch_end_timestamp = v.epoch_end_timestamp.encode_timestamp_millis();
149149

150150
RadioUsageStatsReqV1 {
151151
hotspot_pubkey: v.hotspot_pubkey.into(),

0 commit comments

Comments
 (0)