added new maketzdata.pl in this location; regenerated tzdata.c straight from Olson data via vzic, without --pure option. Less carbohydrates and same great taste as the old tzdata.c, but without nasty compatability problems.

This commit is contained in:
vladimir%pobox.com 2005-01-26 23:05:23 +00:00
Родитель 2ace206dbf
Коммит 9fca2cc9cb
2 изменённых файлов: 2432 добавлений и 29331 удалений

Просмотреть файл

@ -0,0 +1,93 @@
#!/usr/bin/perl
#
# This script takes a zones.tab file and directory, such as that
# produced from an Olson-format tz database via vzic. Note that it
# should be used on vzic output WITHOUT the --pure option. The
# libical distribution includes ics files generated with --pure,
# which results in both huge files and various incompatability
# problems.
#
# vzic - http://dialspace.dial.pipex.com/prod/dialspace/town/pipexdsl/s/asbm26/vzic/
# olson db - ftp://elsie.nci.nih.gov/pub/
#
use File::Basename;
$TZ_PREFIX = "/mozilla.org/20050126_1";
if ($#ARGV != 1) {
print "Usage: maketzdata.pl zones.tab tzdata.c\n";
die;
}
$zonetabfile = $ARGV[0];
$zonetabdir = dirname($zonetabfile);
$tzdatafile = $ARGV[1];
open ZONETAB, $zonetabfile || die "Can't open $zonetab";
@zonetab = <ZONETAB>;
close ZONETAB;
open TZDATA, ">" . $tzdatafile || die "Can't open $tzdata for writing";
print TZDATA <<EOF
/**
** Automagically generated via maketzdata.pl from zone.tab
** DO NOT EDIT BY HAND
**/
typedef struct {
/* the tzid for this */
char *tzid;
/* latitude and longitude, in +/-HHMMSS format */
char *latitude;
char *longitude;
/* the ics VTIMEZONE component */
char *icstimezone;
} ical_timezone_data_struct;
static ical_timezone_data_struct ical_timezone_data[] = {
EOF
;
$first = 1;
foreach my $tz (@zonetab) {
chop $tz;
if ($first != 1) {
print TZDATA ",\n";
}
($lat, $long, $name) = split(/ /, $tz);
my $tzdata = "";
{
local $/ = undef;
open TZFILE, "$zonetabdir/$name.ics" || die "Can't open timezone file $zonetabdir/$name";
$tzdata = <TZFILE>;
close TZFILE;
}
# escape quotes
$tzdata =~ s/\"/\\\"/sg;
$tzdata =~ s/\n/\\n/sg;
print TZDATA <<EOF
{
"$TZ_PREFIX/$name",
"$lat", "$long",
"$tzdata"
}
EOF
;
$first = 0;
}
print TZDATA <<EOF
,
{ NULL, NULL, NULL, NULL }
};
EOF
;
close TZDATA;

Разница между файлами не показана из-за своего большого размера Загрузить разницу