Skip to content

Commit

Permalink
Change default source timestamp to None
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag authored and erikbosch committed Mar 4, 2024
1 parent 7d405ee commit 1bd6cfb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl From<proto::Datapoint> for broker::Datapoint {
source_ts: match from.timestamp {
Some(ts) => match std::convert::TryInto::try_into(ts) {
Ok(ts) => Some(ts),
Err(_) => Some(SystemTime::now()),
Err(_) => None,
},
None => None,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ impl From<&proto::Datapoint> for broker::Datapoint {

match &datapoint.timestamp {
Some(source_timestamp) => {
let source_ts = source_timestamp
.clone()
.try_into()
.unwrap_or_else(|_| SystemTime::now());
let source: Option<SystemTime> = match source_timestamp.clone().try_into() {
Ok(source) => Some(source),
Err(_) => None,
};
broker::Datapoint {
ts,
source_ts: Some(source_ts),
source_ts: source,
value,
}
}
Expand Down
1 change: 1 addition & 0 deletions kuksa_databroker/databroker/src/viss/v2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl Viss for Server {
datapoint: None,
actuator_target: Some(Some(broker::Datapoint {
value: actuator_target,
source_ts: None,
ts: SystemTime::now(),
})),
entry_type: None,
Expand Down

0 comments on commit 1bd6cfb

Please sign in to comment.