duino-coin
duino-coin copied to clipboard
Feature/timezone by ip
Description
This pull request replaces the manual timezone configuration with dynamic timezone detection using the ezTime library. The device now determines its timezone based on the IP address using the public API ip-api.com.
Changes introduced
- Integrated the
ezTimelibrary for timezone and NTP support - Replaced the
setTimezone()function withsetTimezoneByIP(), which:- Performs an HTTP GET request to retrieve timezone information based on IP
- Calls
tz.setLocation()using the received timezone string - Automatically synchronizes the device time using NTP (
waitForSync())
- Replaced
getLocalTime()withezTime::now()andlocaltime()for building thestruct tm - Updated
updateTimeDisplayData()to reflect the new timezone-aware implementation - Retained date/time formatting using
strftime()
Benefits
- Automatically handles Daylight Saving Time (DST) transitions
- Eliminates the need for hardcoded POSIX timezone strings
- Increases portability and flexibility for international deployments
Notes
- Requires an active Wi-Fi connection to perform IP-based timezone detection
- The
ezTimelibrary must be installed via the Arduino Library Manager