diff --git a/src/main.rs b/src/main.rs index 863e3d7..0b3c0d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -81,7 +81,8 @@ fn main() -> Result<(), Box> { fn aggregate_values(conn: &mut PooledConn, date: NaiveDate) -> Result<(), Box> { - let start_time = Utc.with_ymd_and_hms(date.year(), date.month(), date.day(), 00, 00, 00).unwrap() - Duration::minutes(15); + let average_duration = 15; + let start_time = Utc.with_ymd_and_hms(date.year(), date.month(), date.day(), 00, 00, 00).unwrap() - (Duration::minutes(average_duration) / 2); let end_time = start_time + Duration::days(1); let sensors = [ @@ -89,7 +90,6 @@ fn aggregate_values(conn: &mut PooledConn, date: NaiveDate) -> Result<(), Box