diff options
author | gjb <gjb@FreeBSD.org> | 2016-11-04 17:55:50 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2016-11-04 17:55:50 +0000 |
commit | 70abead4e0230e093e460214ec210f8842f0f59f (patch) | |
tree | 889aca68793c2728319acf0360d50a26e418565c /contrib/tzdata/zoneinfo2tdf.pl | |
parent | 0283a0b5f8f154324ad85e8e28fd51fb3d6fe071 (diff) | |
download | FreeBSD-src-70abead4e0230e093e460214ec210f8842f0f59f.zip FreeBSD-src-70abead4e0230e093e460214ec210f8842f0f59f.tar.gz |
MFC r308270:
MFV r308265: Update tzdata to 2016i.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/tzdata/zoneinfo2tdf.pl')
-rwxr-xr-x | contrib/tzdata/zoneinfo2tdf.pl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/contrib/tzdata/zoneinfo2tdf.pl b/contrib/tzdata/zoneinfo2tdf.pl new file mode 100755 index 0000000..e05ec01 --- /dev/null +++ b/contrib/tzdata/zoneinfo2tdf.pl @@ -0,0 +1,52 @@ +#! /usr/bin/perl -w + +# Courtesy Ken Pizzini. + +use strict; + +#This file released to the public domain. + +# Note: error checking is poor; trust the output only if the input +# has been checked by zic. + +my $contZone = ''; +while (<>) { + my $origline = $_; + my @fields = (); + while (s/^\s*((?:"[^"]*"|[^\s#])+)//) { + push @fields, $1; + } + next unless @fields; + + my $type = lc($fields[0]); + if ($contZone) { + @fields >= 3 or warn "bad continuation line"; + unshift @fields, '+', $contZone; + $type = 'zone'; + } + + $contZone = ''; + if ($type eq 'zone') { + # Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] + my $nfields = @fields; + $nfields >= 5 or warn "bad zone line"; + if ($nfields > 6) { + #this splice is optional, depending on one's preference + #(one big date-time field, or componentized date and time): + splice(@fields, 5, $nfields-5, "@fields[5..$nfields-1]"); + } + $contZone = $fields[1] if @fields > 5; + } elsif ($type eq 'rule') { + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S + @fields == 10 or warn "bad rule line"; + } elsif ($type eq 'link') { + # Link TARGET LINK-NAME + @fields == 3 or warn "bad link line"; + } elsif ($type eq 'leap') { + # Leap YEAR MONTH DAY HH:MM:SS CORR R/S + @fields == 7 or warn "bad leap line"; + } else { + warn "Fubar at input line $.: $origline"; + } + print join("\t", @fields), "\n"; +} |