From 20ac7ccf95a652d154c73a9987164aead100c4c2 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Wed, 10 Aug 2022 09:59:27 +1000 Subject: [PATCH] update for fh5-common changes --- Cargo.lock | 1 + fh5-common | 2 +- src/main.rs | 14 ++++++-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76aeaec..06cab88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,6 +130,7 @@ dependencies = [ name = "fh5-common" version = "0.1.0" dependencies = [ + "chrono", "serde", ] diff --git a/fh5-common b/fh5-common index 5c51da0..9ac07ca 160000 --- a/fh5-common +++ b/fh5-common @@ -1 +1 @@ -Subproject commit 5c51da0747206cc8e404fc566a95b5befa94911c +Subproject commit 9ac07ca5051e8ed5dce86b2363721823732dff83 diff --git a/src/main.rs b/src/main.rs index 84696b8..c95487b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use fh5_common::Telemetry; +use fh5_common::{Filename, Telemetry}; use std::fs::OpenOptions; use std::net::UdpSocket; @@ -111,15 +111,13 @@ fn main() { } // open file for this race // filename format: timestamp _ car class _ car ordinal + let name = Filename::new_filename( + deserialised.car_performance_index, + deserialised.car_ordinal, + ); writer = csv::Writer::from_writer( options - .open(folder_path.join(format!( - "{}_{}_{}{}", - &Local::now().format("%Y-%m-%d_%H-%M").to_string(), - deserialised.car_performance_index, - deserialised.car_ordinal, - ".csv", - ))) + .open(folder_path.join(format!("{}{}", name.get_string(), ".csv",))) .expect("couldnt open file"), ); } else {