tzLib does not automatically set a device's local time based upon the device's physical location ... but it does make it possible for developers and users to change the device's time zone in real time based on web-based triggers or geopositioning software.
IANA maintains the time zone database that communication companies and OS vendors use to manage local time world wide.
Using an IANA defined time zone ID as a key, tzLIb issues a PHP query to an HTTP server to obtain the time zone data it needs to configure local time and to perform DST transitions at their scheduled time.
Time zone data is stored in EEPROM to assue that the data is available whenever the system reboots, even if no network connection is available at that time.
setup() {
tzLib.begin(); // <- 1. Prepare tzLib to run
tzLib.setEepromStartByte(0); // <- 2. Tell tzLib where to store data in EEPROM
tzLib.setDefaultZone("<timezone id>"); // <- 3. Set the default time zone
tzLib.setLocalTime(); // <- 4. Configure local time
}
loop() {
tzLib.maintainLocaltime(); // <- 5. Perform DST transitions & keep time zone data current.
}
I M P O R T A N T
tzLib documentation includes an Overview, a QuickStart Guide, a Reference Guide, and a manual that explains how the author created the HTTP server he used for testing tzLib. https://github.com/rwpalmer/tzLib/tree/master/doc
tzLib is packaged with three firmware examples. All three are designed to be run with a serial console.
Sample "serial console output" is included in the comments at the the bottom of each example's .ino file. tzLib301.ino comments includes HTML that can be used to trigger a time zone change on the device. https://github.com/rwpalmer/tzLib/tree/master/examples
tzLib (0.1.1) will exit alpha testing soon.
Code and documentation are under review.
To support beta testing, an HTTP server has been connected to the web, and the library has been preconfigured to use this server by default.
For those who wish to create their server, or to use an alternate server.
The search for someone to host the production HTTP server is underway. We hope to find a corporate entity who can host the PHP file in their data-center, so library users will have a platform that they can rely upon. Please contact the author if you can help, or if you have any contacts who might be able to help in this effort.
Hosting requirements are minimal:
Please report any issues, suggestions, and comments to the author and maintainer: rwpalmeribm@gmail.com
Many thanks to Kasper Kamperman (https://www.kasperkamperman.com) for suggesting the move from Java to PHP, and for helping to assemble the PHP code used in this project.