Skip to content

Commit

Permalink
check timestamp difference
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Jan 3, 2024
1 parent a231507 commit 7708a77
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/data/klimalogger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ impl CheckMessage for SensorLogger {
let naive_date_time = chrono::NaiveDateTime::from_timestamp_opt(result.timestamp as i64, 0).expect("failed to convert timestamp");
let date_time = DateTime::<Utc>::from_naive_utc_and_offset(naive_date_time, Utc);

let now = chrono::offset::Utc::now();

let difference = now - date_time;

if difference.num_seconds() > 10 {
println!("high time offset for {}: {}", location, difference);
}

let sensor_reading = SensorReading {
measurement: measurement.to_string(),
time: date_time,
Expand Down

0 comments on commit 7708a77

Please sign in to comment.