diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-01-11 14:40:42 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-01-11 14:40:42 +0300 |
commit | 4eadb321aa742abfc31686ea7bc577fb1c25d5dd (patch) | |
tree | b16d4db3ea8b1a7a10f20104a456562b8da35859 /src/Storage | |
parent | 5ff678917d3eee259687d5ef235c107126330898 (diff) |
Added Job members to object model
Also changed all calls to gmtime to use gmtime_r instead, for thread
safety
Diffstat (limited to 'src/Storage')
-rw-r--r-- | src/Storage/FileInfoParser.cpp | 16 | ||||
-rw-r--r-- | src/Storage/MassStorage.cpp | 7 |
2 files changed, 4 insertions, 19 deletions
diff --git a/src/Storage/FileInfoParser.cpp b/src/Storage/FileInfoParser.cpp index d232f360..d6b8d933 100644 --- a/src/Storage/FileInfoParser.cpp +++ b/src/Storage/FileInfoParser.cpp @@ -12,22 +12,6 @@ #include "PrintMonitor.h" #include "GCodes/GCodes.h" -void GCodeFileInfo::Init() -{ - isValid = false; - incomplete = true; - firstLayerHeight = 0.0; - objectHeight = 0.0; - layerHeight = 0.0; - printTime = simulatedTime = 0; - numFilaments = 0; - generatedBy.Clear(); - for (size_t extr = 0; extr < MaxExtruders; extr++) - { - filamentNeeded[extr] = 0.0; - } -} - #if HAS_MASS_STORAGE FileInfoParser::FileInfoParser() noexcept diff --git a/src/Storage/MassStorage.cpp b/src/Storage/MassStorage.cpp index 81882d14..2041e09f 100644 --- a/src/Storage/MassStorage.cpp +++ b/src/Storage/MassStorage.cpp @@ -467,10 +467,11 @@ time_t MassStorage::GetLastModifiedTime(const char *filePath) noexcept bool MassStorage::SetLastModifiedTime(const char *filePath, time_t time) noexcept { - const struct tm * const timeInfo = gmtime(&time); + tm timeInfo; + gmtime_r(&time, &timeInfo); FILINFO fno; - fno.fdate = (WORD)(((timeInfo->tm_year - 80) * 512U) | (timeInfo->tm_mon + 1) * 32U | timeInfo->tm_mday); - fno.ftime = (WORD)(timeInfo->tm_hour * 2048U | timeInfo->tm_min * 32U | timeInfo->tm_sec / 2U); + fno.fdate = (WORD)(((timeInfo.tm_year - 80) * 512U) | (timeInfo.tm_mon + 1) * 32U | timeInfo.tm_mday); + fno.ftime = (WORD)(timeInfo.tm_hour * 2048U | timeInfo.tm_min * 32U | timeInfo.tm_sec / 2U); const bool ok = (f_utime(filePath, &fno) == FR_OK); if (!ok) { |