omit microseconds from file name

This commit is contained in:
2024-10-20 19:45:09 +02:00
parent 40ad69eccd
commit 8691032665
2 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -55,7 +55,7 @@ def main():
record_id = 0
record_list = None
_date_last = None
initial_timestamp = None
file_timestamp = None
vehicle_data_last = None
# Collecting loop
@@ -68,7 +68,7 @@ def main():
_date_last = _date
record_id = 0
record_list = []
initial_timestamp = create_timestamp().replace(':', '-').replace('.', '-')
file_timestamp = create_timestamp(with_ms=False).replace(':', '-').replace('.', '-')
vehicle_data_last = {}
try:
@@ -85,7 +85,7 @@ def main():
# Store record list
print(f"{timestamp}: Store record #{record_id:04d}")
folder = f_mgr.update(f"results/{vin}", _date)
filename = f"vehicle_{vin}_{initial_timestamp}.json"
filename = f"vehicle_{vin}_{file_timestamp}.json"
_path = os.path.join(folder, filename)
with open(_path, "w") as fp:
json.dump(record_list, fp, indent=4)