]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/compat/tzone.pl
3 # Copyright (C) 2016 and later: Unicode, Inc. and others.
4 # License & terms of use: http://www.unicode.org/copyright.html
5 # Copyright (C) 2007-2007, International Business Machines
6 # Corporation and others. All Rights Reserved.
9 if ($ARGV[0] eq '-h' || $ARGV[0] eq '--help') {
10 print "Usage: tzone [year month day hour minute]\n";
14 my $LIBRARY = '../../lib';
16 my @TZONE_RAW = `locate zoneinfo | grep '^/usr/share/zoneinfo/' | grep -v 'tab\$' | grep -v '/right/' | grep -v '/posix/' | grep -v '/posixrules\$' | grep -v '/Factory\$'`;
27 if (scalar(@ARGV) == 5) {
28 ($year, $month, $day, $hour, $minute) = @ARGV;
29 print "The date we are using is: $month-$day-$year $hour:$minute.\n";
31 print "We are using the current date.\n";
35 #filter out the time zones
36 foreach my $tzone (@TZONE_RAW) {
39 $TZONE[$index] = substr($tzone, 20);
44 #go through each timezone and test
46 $ENV{'LD_LIBRARY_PATH'} = $LIBRARY;
48 print "The following time zones had wrong results.\n";
50 foreach my $tzone (@TZONE) {
52 $ENV{'TZ'} = "$tzone";
54 my @result = `./tzdate $year $month $day $hour $minute $USECURRENT`;
56 #if the result is wrong print the time zone information to a log file
57 if (scalar(@result) > 0) {
58 print "\nTIME ZONE: $tzone\n";
64 print "\nThe number of time zones with wrong results: $count out of $index\n";
66 print("\n\nGood Bye!\n");