X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fzoneinfo2lua.pl;h=722711a97c8356cf0fd9305c36151f8a15074dbf;hp=fdcc3d60ec7c0a4dfa2feec32a1a28d1724b6258;hb=f77b1111e4e413b383295dc2c4afd95ae4b0b9a5;hpb=0d00e3b691146fbd0f51b0782988a62621a72b88 diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl old mode 100644 new mode 100755 index fdcc3d60e..722711a97 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -7,8 +7,11 @@ use strict; my %TZ; +my $tzdin = $ARGV[0] || "/usr/share/zoneinfo"; +my $tzdout = $ARGV[1] || "./libs/sys/luasrc/sys/zoneinfo"; + local $/ = "\012"; -open( ZTAB, "< ./zone.tab" ) || die "Unable to open zone.tab: $!"; +open( ZTAB, "< $tzdin/zone.tab" ) || die "open($tzdin/zone.tab): $!"; while( ! eof ZTAB ) { chomp( my $line = readline ZTAB ); @@ -18,7 +21,7 @@ while( ! eof ZTAB ) { printf STDERR "%-40s", $zone; - if( open ZONE, "< ./$zone" ) { + if( open ZONE, "< $tzdin/$zone" ) { seek ZONE, -2, 2; while( tell(ZONE) > 0 ) { @@ -37,14 +40,17 @@ while( ! eof ZTAB ) { } else { - print STDERR "Unable to open $zone: $!\n"; + print STDERR "open($tzdin/$zone): $!\n"; } } close ZTAB; -print < $tzdout/tzdata.lua") || die "open($tzdout/tzdata.lua): $!\n"; + +print STDERR "Writing time zones to $tzdout/tzdata.lua ... "; +print O < $tzdout/tzoffset.lua") || die "open($tzdout/tzoffset.lua): $!\n"; + +print STDERR "Writing time offsets to $tzdout/tzoffset.lua ... "; +print O <