How To Install Using Arduino Library Manager
Why do we need this Timezone_Generic Library
The Timezone_Generic Library is designed to work in conjunction with the Arduino Time library, which must also be installed on your system. This documentation assumes some familiarity with the Time library.
The primary goal of the Timezone_Generic Library is to convert Universal Coordinated Time (UTC) to the correct local time, whether it is Daylight Saving Time (a.k.a. summer time, DST) or standard time. The time source could be a GPS receiver, an NTP server, or a Real-Time Clock (RTC) set to UTC. But whether a hardware RTC or other time source is even present is immaterial, since the Time library can function as a software RTC without additional hardware (although its accuracy is dependent on the accuracy of the microcontroller's system clock.)
The Timezone_Generic Library implements two objects to facilitate time zone conversions:
-
A TimeChangeRule object describes when local time changes to daylight (summer) time, or to standard time, for a particular locale.
-
A Timezone object uses TimeChangeRules to perform conversions and related functions. It can also write its TimeChangeRules to or read them from EEPROM/DueFlashStorage/FlashStorage/LittleFS/SPIFFS. Multiple time zones can be represented by defining multiple Timezone objects.
The examples will demonstrate how to get the UTC time from NTP server, then update the DS3231 RTC to make sure the time is perfectly correct.
You can also modify the examples to read the NTP and update RTC once per every pre-determined period to ensure the RTC accuracy.
This Timezone_Generic Library is based on and modified from Jack Christensen's Timezone Library to add functions and support to many boards and shields.
Releases v1.2.5
- Add examples to use STM32 Built-In RTC.
Releases v1.2.4
- Initial porting to many Generic boards using WiFi/Ethernet modules/shields.
- Add support to SAMD21/SAMD51, nRF52, STM32F/L/H/G/WB/MP1 with WiFiNINA, ESP8266-AT, W5x00, ENC28J60, LAN8742A Ethernet modules/shields.
- Add support to SAM DUE DueFlashStorage, SAMD FlashStorage, nRF52 LittleFS, STM32 and AVR EEPROM
- Add functions.
- Completely new examples using NTP time to update DS3231 RTC.
Currently Supported Boards
- ESP8266. To be done soon.
- ESP32. To be done soon.
- AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox etc..
- Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.).
- Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0, Gemma M0, etc.).
- Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)
- STM32 (Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32F1, STM32F3, STM32F4, STM32H7, STM32L0, etc.).
- STM32F/L/H/G/WB/MP1 (Nucleo-64 L053R8,Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32Fx, STM32H7, STM32Lx, STM32Gx, STM32WB, STM32MP1, etc.) having 64K+ Flash program memory.
Currently Supported WiFi Modules/Shields
- ESP8266 built-in WiFi. To be done soon.
- ESP32 built-in WiFi. To be done soon.
- WiFiNINA using WiFiNINA or WiFiNINA_Generic library.
- ESP8266-AT, ESP32-AT WiFi shields using WiFiEspAT or ESP8266_AT_WebServer library.
Currently Supported Ethernet Modules/Shields
- W5x00's using Ethernet, EthernetLarge, Ethernet2 or Ethernet3 Library.
- ENC28J60 using EthernetENC or UIPEthernet library.
- LAN8742A using STM32Ethernet / STM32 LwIP libraries.
Currently Supported storage
- ESP8266 EEPROM, LittleFS, SPIFFS. To be done soon.
- ESP32 EEPROM, SPIFFS. To be done soon.
- SAM DUE DueFlashStorage.
- SAMD FlashStorage.
- nRF52 LittleFS.
- STM32 and AVR EEPROM.