From 78f5e3fc900f80f52034ac889fa90081bc37bbc4 Mon Sep 17 00:00:00 2001 From: Steve Gearhart Date: Sat, 20 Jan 2024 20:25:35 +0000 Subject: [PATCH] Update viatom_loader.cpp - Remove filename extension --- oscar/SleepLib/loader_plugins/viatom_loader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oscar/SleepLib/loader_plugins/viatom_loader.cpp b/oscar/SleepLib/loader_plugins/viatom_loader.cpp index 34787c3d..60ec78c6 100644 --- a/oscar/SleepLib/loader_plugins/viatom_loader.cpp +++ b/oscar/SleepLib/loader_plugins/viatom_loader.cpp @@ -314,7 +314,11 @@ bool ViatomFile::ParseHeader() QDateTime data_timestamp = QDateTime(QDate(year, month, day), QTime(hour, min, sec)); QString date_string = QFileInfo(m_file).fileName().section("_", -1); // Strip any SleepU_ etc. prefix. - QString format_string = "yyyyMMddHHmmss"; + + int lastPoint = date_string.lastIndexOf("."); // Added to strip off any filename extension + date_string = date_string.left(lastPoint); + + QString format_string = "yyyyMMddHHmmss"; if (date_string.contains(":")) { format_string = "yyyy-MM-dd HH:mm:ss"; }