Set system time so LittleFS can take over the real time
Andreotti100 opened this issue · 0 comments
Andreotti100 commented
Using this library resulted in wrong file time stamps, 1970 style.
So, I made a change:
#include <coredecls.h> // Needed for setting the right system time
void setTime(time_t t) {
#ifdef TIME_DRIFT_INFO
if(sysUnsyncedTime == 0)
sysUnsyncedTime = t; // store the time of the first call to set a valid Time
#endif
sysTime = (uint32_t)t;
nextSyncTime = (uint32_t)t + syncInterval;
Status = timeSet;
prevMillis = millis(); // restart counting from now (thanks to Korman for this fix)
tune_timeshift64((uint64_t)sysTime * 1000000ULL); // Take over the new time into the system time
}