sdcard.cpp: adapt to eztime removal

This commit is contained in:
cyberman54 2022-01-20 17:37:34 +01:00
parent f8e8aec6e0
commit 7d9d6d81c4

View File

@ -44,6 +44,10 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle,
static int counterWrites = 0; static int counterWrites = 0;
char tempBuffer[12 + 1]; char tempBuffer[12 + 1];
time_t t = time(NULL); time_t t = time(NULL);
struct tm tt;
localtime_r(&t, &tt);
mktime(&tt);
#if (HAS_SDS011) #if (HAS_SDS011)
sdsStatus_t sds; sdsStatus_t sds;
#endif #endif
@ -52,9 +56,9 @@ void sdcardWriteData(uint16_t noWifi, uint16_t noBle,
return; return;
ESP_LOGD(TAG, "writing to SD-card"); ESP_LOGD(TAG, "writing to SD-card");
sprintf(tempBuffer, "%02d.%02d.%4d,", day(t), month(t), year(t)); strftime(tempBuffer, sizeof(tempBuffer), "%d.%m.%Y", &tt);
fileSDCard.print(tempBuffer); fileSDCard.print(tempBuffer);
sprintf(tempBuffer, "%02d:%02d:%02d,", hour(t), minute(t), second(t)); strftime(tempBuffer, sizeof(tempBuffer), "%H.%M.%S", &tt);
fileSDCard.print(tempBuffer); fileSDCard.print(tempBuffer);
sprintf(tempBuffer, "%d,%d", noWifi, noBle); sprintf(tempBuffer, "%d,%d", noWifi, noBle);
fileSDCard.print(tempBuffer); fileSDCard.print(tempBuffer);