Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions file_store/src/usage_counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,34 @@ impl MsgDecode for RadioUsageStatsReq {

impl MsgTimestamp<Result<DateTime<Utc>>> for HexUsageStatsReqV1 {
fn timestamp(&self) -> Result<DateTime<Utc>> {
self.timestamp.to_timestamp()
self.timestamp.to_timestamp_millis()
}
}

impl MsgTimestamp<u64> for HexUsageStatsReq {
fn timestamp(&self) -> u64 {
self.timestamp.encode_timestamp()
self.timestamp.encode_timestamp_millis()
}
}

impl MsgTimestamp<Result<DateTime<Utc>>> for RadioUsageStatsReqV1 {
fn timestamp(&self) -> Result<DateTime<Utc>> {
self.timestamp.to_timestamp()
self.timestamp.to_timestamp_millis()
}
}

impl MsgTimestamp<u64> for RadioUsageStatsReq {
fn timestamp(&self) -> u64 {
self.timestamp.encode_timestamp()
self.timestamp.encode_timestamp_millis()
}
}

impl TryFrom<HexUsageStatsReqV1> for HexUsageStatsReq {
type Error = Error;
fn try_from(v: HexUsageStatsReqV1) -> Result<Self> {
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))
})?;
Expand All @@ -101,8 +101,8 @@ impl TryFrom<HexUsageStatsReqV1> for HexUsageStatsReq {
impl From<HexUsageStatsReq> 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(),
Expand All @@ -124,8 +124,8 @@ impl TryFrom<RadioUsageStatsReqV1> for RadioUsageStatsReq {
type Error = Error;
fn try_from(v: RadioUsageStatsReqV1) -> Result<Self> {
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,
Expand All @@ -144,8 +144,8 @@ impl TryFrom<RadioUsageStatsReqV1> for RadioUsageStatsReq {
impl From<RadioUsageStatsReq> 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(),
Expand Down
Loading