From cddea04837410ab78ab735f4e9aadad473918eb1 Mon Sep 17 00:00:00 2001 From: Phil Olynyk Date: Thu, 21 Sep 2017 10:41:35 -0400 Subject: [PATCH] Set m_starttime to current day if no date in file (CMS50D+) --- sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp index a50e0d8c..64bb71ad 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp @@ -599,8 +599,11 @@ bool CMS50Loader::readSpoRFile(QString path) in >> year >> month >> day; in >> hour >> minute >> second; - - m_startTime = QDateTime(QDate(year, month, day), QTime(hour, minute, second)); + + if ( year == 0 ) // typically from a CMS50D+ + m_startTime = QDateTime(QDate::currentDate(), QTime(hour, minute, second)); + else + m_startTime = QDateTime(QDate(year, month, day), QTime(hour, minute, second)); // ignoring it for now pos += 0x1c + 200; @@ -612,7 +615,7 @@ bool CMS50Loader::readSpoRFile(QString path) bytes_per_record = remainder / samples; qDebug() << samples << "samples of" << bytes_per_record << "bytes each"; - // CMS50I .spo2 data have 4 digits, a 16bit, followed by spo2 then pulse + // CMS50I .spo2 data have 4 bytes: a 16bit, followed by spo2 then pulse }