update-tz-database

I have tried to account for the display of certain errors, but they might sometimes be LTA. The most important things is to have all of the base modules and command line tools:

To run, just use the command

raku update-tz-database.raku

There are currently no options, but eventually I will add options to skip certain steps to be performed manually in case something is causing them problems.

First we have a few constants:

First we download the files from the IANA website. Thankfully these days it shouldn't take that long

The archives contain a fair number of extra files that we do not need. Out of the tzdata archive, we grab the files with mostly modern information and avoid the historical ones because they are known to be less accurate. But maybe one day as an option...

From the code archive, we only need to compile the ZIC, and so we grab only the files needed for its compilation. (Code for localtime was ported directly to Raku.)

Compiling immediately after extraction would result in an error because it requires a version.h file. That file is created via the Makefile, but why waste our time? The values it holds are only for printing out usage/version information, which we don't care about. Consequently, the file has already been included (and should not be deleted in distributions of this module) as the following:

static char const PKGVERSION[]="";
    static char const TZVERSION[]="";
    static char const REPORT_BUGS_TO[]="";

GCC is required, but perhaps other compilers could be enabled in the future. We do a basic compile without optimization because the processing is so fast anyways.

With ZIC compiled, we begin processing the data files. Each of the regional files (Europe, Asia, etc) contain dozens of different zones with hundreds of rules, as well as a fair number of links. Right now we don't do anything special with the links -- ZIC outputs multiple copies of the same zone under each name. To be memory efficient, we could eventually link them through binding at run time and remove the excess to reduce download size.

Around 1993, a number of timezones were renamed. These name changes were included as links in a separate file. We read them in here separately.

Each TZif file must be included in the META6.json file, and since the files aren't static, we just generate the entire document inside of this script. It isn't smart enough to properly adjust the version information, but if it detects a situation wherein that's necessary, it will alert the user at the end of execution.

Cleaning up after ourselves also means that no one will ever pollute GitHub with all of our intermediate files (something I've never done, of course.

The final step of the update is to compare the old and new versions. If the just-installed version is newer, then it's imperative that an incremental update be published. Otherwise,

Timezones::ZoneInfo v0.3.0

A module providing timezone data and routines, based on IANA’s tz database and code

Authors

  • Matthew Stephen STUCKWISCH

License

CC0-1.0

Dependencies

Test Dependencies

Provides

  • CX::Warn::Timezones::UnknownID
  • Timezones::ZoneInfo
  • Timezones::ZoneInfo::ConvRule
  • Timezones::ZoneInfo::LeapSecInfo
  • Timezones::ZoneInfo::Link
  • Timezones::ZoneInfo::Routines
  • Timezones::ZoneInfo::State
  • Timezones::ZoneInfo::Time
  • Timezones::ZoneInfo::TransTimeInfo

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.