Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-11 14:40:42 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-11 14:40:42 +0300
commit4eadb321aa742abfc31686ea7bc577fb1c25d5dd (patch)
treeb16d4db3ea8b1a7a10f20104a456562b8da35859 /src/Storage/MassStorage.cpp
parent5ff678917d3eee259687d5ef235c107126330898 (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/MassStorage.cpp')
-rw-r--r--src/Storage/MassStorage.cpp7
1 files changed, 4 insertions, 3 deletions
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)
{