On Time With Time Zones
What's the best way to keep your time zone definitions up to date? There's a new open source tool out for that, as well as an explanation of why it matters.
Join the DZone community and get the full member experience.Join For Free
Azul often gets asked how to apply newer time zone definitions to already-installed JDKs. Up until now, the answers have been:
Update your JDK to the latest revision, which will have newer time zone details inside.
Download and use tzupdater.
Since the answer for 2 is free but not always attractive, we now provide an open source equivalent utility called ZIUpdater. This tool performs a subset of the functionality of tzupdater, though upholds the core use case of applying IANA time zone definitions to installed JDKs. The current version of ZIUpdater works with Azul Zulu and Azul Zing, whether packaged as JDKs or as JREs, and also proves in our testing to be compatible with OpenJDK and Oracle JDK.
ZIUpdater provides a functional subset of the equivalent Oracle tool TZUpdater. The current version of ZIUpdater updates the zone information obtained from any downloaded copy of the IANA time zone database. ZIUpdater performs a compilation step, transforming the IANA database into a JDK-compatible file set, then applies it to the file tree of the invoked JDK/JRE. You may use ZIUpdater on any platform (Windows, Linux, Mac, etc.) where you have installed Java 8 or Java 7. By design, it is a single JAR file and works with Zulu and Zing, but ZIUpdater has also been successfully tested against OpenJDK 8 and Oracle JDK 8. It also can forcefully apply older databases, and not only accepting just the newest one.
The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe. It is updated periodically to reflect changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules.
The Time Zone Database is sometimes called the Olson database, referring to the founding contributor, Arthur David Olson, then at the US National Institutes of Health, who cobbled it together with Paul Eggert, a computer scientist at the University of California, Los Angeles.
Stephen Colebourne captures nicely the impact of the original Olson database outage and associated legal case in his 2011 blog post. Thankfully, the suit later got dismissed and now IANA maintains time zone database updates.
Why keep your time zone definitions up to date? It turns out both time zones and daylight saving times are politically driven, and subject to frequent changes as political tastes change in disparate areas across the globe. Jon Udell captures the flavor of the nuances of the rules that form historical time zone offsets with great examples of local times affecting Alaska, Portugal, and a tiny patch of the south coast of Australia. If your software serves a global audience, then you’d be wise to ensure your date calculations match the end user local experience, no matter where — or when — they are.
Published at DZone with permission of Matt Schuetze. See the original article here.
Opinions expressed by DZone contributors are their own.