(Updated at 01/23/2023)
And yes, the ESP32 can retrieve the exact time and date with just an Internet connection. As soon as the ESP32 is completely turned off, it loses track of time. It is like an oven or microwave clock that displays
00:00 when there was a power failure. The most classical way is then to use an external RTC with a battery permanently connected
This is typically what he had in the old computer towers to maintain the BIOS clock with a CMOS battery.
But this requires additional equipment, more space and costs more.
Synchronizing the clock is very useful when the ESP32 wakes up from time to time to communicate with WEB services, and wants to date its packets with the right date. It can also be useful to have an alarm clock that executes a task at a specific time.
An external RTC clock may be useful if the ESP32 does not have an Internet connection. It is possible to use an NTP server to adjust the RTC clock and synchronize it with the real time 😉.
NTP (Network Time Protocol) servers are designed to synchronize the clocks of computers on a computer network. Their purpose is to ensure that all computers on the network share the same time, which is important for various applications, such as file management or computer security. It is also to avoid errors due to a lack of synchronization of clocks.