esp_garden git · master
Distributed ESP sensor and actuator system (garden)
C++ 70.7% Markdown 18% C 10.7%git clone https://git.christianimmanuel.de/embedded/esp_garden.gitwget https://git.christianimmanuel.de/embedded/esp_garden/archive/esp_garden.tar.gzFix Year 2038 proof
globals.h | 4 ++-- post_server/WiFiManager.cpp | 6 +++--- post_server/WiFiManager.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/globals.h b/globals.h index 6752685..2c13207 100644 --- a/globals.h +++ b/globals.h @@ -66,11 +66,11 @@ struct SensorConfig_s { struct SensorEntry { char table[TABLE_SIZE]; char value[VALUE_SIZE]; - uint32_t time; + uint64_t time; }; typedef struct struct_message_server { - uint32_t time; + uint64_t time; } struct_message_server; typedef struct struct_message_client { diff --git a/post_server/WiFiManager.cpp b/post_server/WiFiManager.cpp index f90c9ac..4cb4b42 100644 --- a/post_server/WiFiManager.cpp +++ b/post_server/WiFiManager.cpp @@ -169,8 +169,8 @@ bool WIFI_GetSensorConfigServer(const char* sensor_name, SensorConfigServer_s &c return cfg.success; } -uint32_t now() { - return (uint32_t)time(nullptr); +uint64_t now() { + return (uint64_t)time(nullptr); } void WIFI_Try(uint8_t max_attempts) { @@ -198,7 +198,7 @@ void WIFI_Try(uint8_t max_attempts) { void WIFI_SyncTime() { DBG_PRINTLN("Syncing time..."); configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER); - uint32_t t = time(nullptr); + uint64_t t = now(); uint8_t tries = 0; while (t < 1600000000 && tries++ < 20) { delay(500); t = time(nullptr); } if (t < 1600000000) DBG_PRINTLN("NTP sync failed!"); diff --git a/post_server/WiFiManager.h b/post_server/WiFiManager.h index 79c49ab..7ba92e5 100644 --- a/post_server/WiFiManager.h +++ b/post_server/WiFiManager.h @@ -10,7 +10,7 @@ bool WIFI_GetSensorConfigServer(const char* sensor_name, SensorConfigServer_s &c using WIFI_ReadingCallback = void(*)(const char* table, const char* value); extern WIFI_ReadingCallback WIFI_OnAddReading; -uint32_t now(); +uint64_t now(); void WIFI_Try(uint8_t max_attempts = 20); void WIFI_SyncTime(); bool WIFI_PostBuffer();