timezone 1.3.6 → 1.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGES.markdown +20 -0
- data/CONTRIBUTING.markdown +8 -2
- data/Rakefile +3 -1
- data/benchmark.rb +16 -29
- data/data/Africa/Accra +61 -47
- data/data/Africa/Addis_Ababa +5 -4
- data/data/Africa/Algiers +2 -2
- data/data/Africa/Asmara +5 -4
- data/data/Africa/Asmera +5 -4
- data/data/Africa/Bangui +4 -1
- data/data/Africa/Brazzaville +4 -1
- data/data/Africa/Casablanca +11 -11
- data/data/Africa/Dar_es_Salaam +5 -4
- data/data/Africa/Djibouti +5 -4
- data/data/Africa/Douala +4 -1
- data/data/Africa/El_Aaiun +11 -11
- data/data/Africa/Kampala +5 -4
- data/data/Africa/Kinshasa +4 -1
- data/data/Africa/Lagos +4 -1
- data/data/Africa/Libreville +4 -1
- data/data/Africa/Luanda +4 -1
- data/data/Africa/Malabo +4 -1
- data/data/Africa/Mogadishu +5 -4
- data/data/Africa/Nairobi +5 -4
- data/data/Africa/Niamey +4 -1
- data/data/Africa/Porto-Novo +4 -1
- data/data/America/Belize +44 -1
- data/data/America/Dawson +2 -38
- data/data/America/Grand_Turk +1 -2
- data/data/America/Nassau +6 -1
- data/data/America/Nuuk +120 -0
- data/data/America/Whitehorse +2 -38
- data/data/Antarctica/Casey +6 -1
- data/data/Antarctica/Macquarie +58 -3
- data/data/Asia/Chongqing +3 -1
- data/data/Asia/Chungking +3 -1
- data/data/Asia/Gaza +58 -56
- data/data/Asia/Harbin +3 -1
- data/data/Asia/Hebron +58 -56
- data/data/Asia/Jerusalem +34 -32
- data/data/Asia/Shanghai +3 -1
- data/data/Asia/Tel_Aviv +34 -32
- data/data/Atlantic/Bermuda +29 -2
- data/data/Australia/ACT +9 -9
- data/data/Australia/Adelaide +9 -9
- data/data/Australia/Brisbane +9 -9
- data/data/Australia/Broken_Hill +9 -9
- data/data/Australia/Canberra +9 -9
- data/data/Australia/Currie +22 -10
- data/data/Australia/Darwin +8 -8
- data/data/Australia/Eucla +7 -7
- data/data/Australia/Hobart +12 -8
- data/data/Australia/Lindeman +9 -9
- data/data/Australia/Melbourne +9 -9
- data/data/Australia/NSW +9 -9
- data/data/Australia/North +8 -8
- data/data/Australia/Perth +7 -7
- data/data/Australia/Queensland +9 -9
- data/data/Australia/South +9 -9
- data/data/Australia/Sydney +9 -9
- data/data/Australia/Tasmania +12 -8
- data/data/Australia/Victoria +9 -9
- data/data/Australia/West +7 -7
- data/data/Australia/Yancowinna +9 -9
- data/data/Canada/Yukon +2 -38
- data/data/Europe/Budapest +24 -24
- data/data/Europe/Monaco +3 -3
- data/data/Europe/Paris +3 -3
- data/data/Europe/Volgograd +2 -1
- data/data/Indian/Antananarivo +5 -4
- data/data/Indian/Comoro +5 -4
- data/data/Indian/Mahe +1 -1
- data/data/Indian/Mayotte +5 -4
- data/data/Israel +34 -32
- data/data/PRC +3 -1
- data/data/Pacific/Efate +5 -3
- data/data/Pacific/Fiji +2 -2
- data/lib/timezone/parser.rb +28 -14
- data/lib/timezone/version.rb +1 -1
- data/test/timezone/test_zone.rb +4 -4
- data/timezone.gemspec +0 -2
- metadata +8 -8
- data/data/US/Pacific-New +0 -189
data/data/Australia/Victoria
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
-2364111593:LMT:0:34792
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
691551592:AEST:0:36000
|
3
|
+
7171200:AEDT:1:39600
|
4
|
+
781747200:AEST:0:36000
|
5
|
+
7516800:AEDT:1:39600
|
6
|
+
15724800:AEST:0:36000
|
7
|
+
15724800:AEDT:1:39600
|
8
|
+
16329600:AEST:0:36000
|
9
|
+
15120000:AEDT:1:39600
|
10
|
+
870912000:AEST:0:36000
|
11
11
|
10281600:AEDT:1:39600
|
12
12
|
21168000:AEST:0:36000
|
13
13
|
10886400:AEDT:1:39600
|
data/data/Australia/West
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
-2337925405:LMT:0:27804
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
665372604:AWST:0:28800
|
3
|
+
7171200:AWDT:1:32400
|
4
|
+
781747200:AWST:0:28800
|
5
|
+
7516800:AWDT:1:32400
|
6
|
+
15724800:AWST:0:28800
|
7
|
+
15724800:AWDT:1:32400
|
8
|
+
996710400:AWST:0:28800
|
9
9
|
10886400:AWDT:1:32400
|
10
10
|
273369600:AWST:0:28800
|
11
11
|
10886400:AWDT:1:32400
|
data/data/Australia/Yancowinna
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
-2364110749:LMT:0:33948
|
2
2
|
49159548:AEST:0:36000
|
3
3
|
84762000:ACST:0:32400
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
557631000:ACST:0:34200
|
5
|
+
7171200:ACDT:1:37800
|
6
|
+
781747200:ACST:0:34200
|
7
|
+
7516800:ACDT:1:37800
|
8
|
+
15724800:ACST:0:34200
|
9
|
+
15724800:ACDT:1:37800
|
10
|
+
16329600:ACST:0:34200
|
11
|
+
15120000:ACDT:1:37800
|
12
|
+
870912000:ACST:0:34200
|
13
13
|
10281600:ACDT:1:37800
|
14
14
|
21168000:ACST:0:34200
|
15
15
|
10886400:ACDT:1:37800
|
data/data/Canada/Yukon
CHANGED
@@ -90,41 +90,5 @@
|
|
90
90
|
10890000:PST:0:-28800
|
91
91
|
20559600:PDT:1:-25200
|
92
92
|
10890000:PST:0:-28800
|
93
|
-
|
94
|
-
|
95
|
-
20559600:PDT:1:-25200
|
96
|
-
10890000:PST:0:-28800
|
97
|
-
20559600:PDT:1:-25200
|
98
|
-
10890000:PST:0:-28800
|
99
|
-
20559600:PDT:1:-25200
|
100
|
-
10890000:PST:0:-28800
|
101
|
-
20559600:PDT:1:-25200
|
102
|
-
10890000:PST:0:-28800
|
103
|
-
20559600:PDT:1:-25200
|
104
|
-
10890000:PST:0:-28800
|
105
|
-
20559600:PDT:1:-25200
|
106
|
-
11494800:PST:0:-28800
|
107
|
-
20559600:PDT:1:-25200
|
108
|
-
10890000:PST:0:-28800
|
109
|
-
20559600:PDT:1:-25200
|
110
|
-
10890000:PST:0:-28800
|
111
|
-
20559600:PDT:1:-25200
|
112
|
-
10890000:PST:0:-28800
|
113
|
-
20559600:PDT:1:-25200
|
114
|
-
10890000:PST:0:-28800
|
115
|
-
20559600:PDT:1:-25200
|
116
|
-
11494800:PST:0:-28800
|
117
|
-
20559600:PDT:1:-25200
|
118
|
-
10890000:PST:0:-28800
|
119
|
-
20559600:PDT:1:-25200
|
120
|
-
10890000:PST:0:-28800
|
121
|
-
20559600:PDT:1:-25200
|
122
|
-
10890000:PST:0:-28800
|
123
|
-
20559600:PDT:1:-25200
|
124
|
-
10890000:PST:0:-28800
|
125
|
-
20559600:PDT:1:-25200
|
126
|
-
10890000:PST:0:-28800
|
127
|
-
20559600:PDT:1:-25200
|
128
|
-
11494800:PST:0:-28800
|
129
|
-
20559600:PDT:1:-25200
|
130
|
-
1:PST:0:-28800
|
93
|
+
20552400:PDT:1:-25200
|
94
|
+
1:MST:0:-25200
|
data/data/Europe/Budapest
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
-
|
2
|
-
|
1
|
+
-2498260581:LMT:0:4580
|
2
|
+
804554180:CET:0:3600
|
3
3
|
13222800:CEST:1:7200
|
4
4
|
17028000:CET:0:3600
|
5
5
|
13305600:CEST:1:7200
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
18144000:CET:0:3600
|
7
|
+
13305600:CEST:1:7200
|
8
|
+
18230400:CET:0:3600
|
9
|
+
13219200:CEST:1:7200
|
10
|
+
17539200:CET:0:3600
|
11
|
+
14515200:CEST:1:7200
|
12
|
+
648421200:CET:0:3600
|
13
|
+
49518000:CEST:1:7200
|
12
14
|
12700800:CET:0:3600
|
13
15
|
16329600:CEST:1:7200
|
14
16
|
15724800:CET:0:3600
|
15
17
|
15724800:CEST:1:7200
|
16
18
|
18306000:CET:0:3600
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
15814800:CEST:1:7200
|
20
|
+
12967200:CET:0:3600
|
21
|
+
16412400:CEST:1:7200
|
22
|
+
15642000:CET:0:3600
|
21
23
|
15724800:CEST:1:7200
|
22
24
|
15724800:CET:0:3600
|
23
25
|
15724800:CEST:1:7200
|
24
26
|
16329600:CET:0:3600
|
25
27
|
15120000:CEST:1:7200
|
26
|
-
|
27
|
-
16329600:CEST:1:7200
|
28
|
-
113004000:CET:0:3600
|
28
|
+
146354400:CET:0:3600
|
29
29
|
11487600:CEST:1:7200
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
19969200:CET:0:3600
|
31
|
+
11491200:CEST:1:7200
|
32
|
+
21168000:CET:0:3600
|
33
|
+
10281600:CEST:1:7200
|
34
|
+
21168000:CET:0:3600
|
35
|
+
10281600:CEST:1:7200
|
36
|
+
710632800:CET:0:3600
|
37
|
+
15120000:CEST:1:7200
|
38
38
|
15724800:CET:0:3600
|
39
39
|
15724800:CEST:1:7200
|
40
40
|
15724800:CET:0:3600
|
41
41
|
15724800:CEST:1:7200
|
42
42
|
15724800:CET:0:3600
|
43
43
|
15724800:CEST:1:7200
|
44
|
-
|
44
|
+
15732000:CET:0:3600
|
45
45
|
16329600:CEST:1:7200
|
46
46
|
15724800:CET:0:3600
|
47
47
|
15724800:CEST:1:7200
|
data/data/Europe/Monaco
CHANGED
data/data/Europe/Paris
CHANGED
data/data/Europe/Volgograd
CHANGED
data/data/Indian/Antananarivo
CHANGED
data/data/Indian/Comoro
CHANGED
data/data/Indian/Mahe
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
-
|
1
|
+
-1988163709:LMT:0:13308
|
2
2
|
1:+04:0:14400
|
data/data/Indian/Mayotte
CHANGED
data/data/Israel
CHANGED
@@ -1,47 +1,49 @@
|
|
1
1
|
-2840149255:LMT:0:8454
|
2
2
|
1199145614:JMT:0:8440
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
707365240:IST:0:7200
|
4
|
+
10540800:IDT:1:10800
|
5
|
+
4060800:IST:0:7200
|
6
|
+
61689600:IDT:1:10800
|
7
|
+
13046400:IST:0:7200
|
8
|
+
18489600:IDT:1:10800
|
9
|
+
13132800:IST:0:7200
|
10
|
+
18489600:IDT:1:10800
|
11
|
+
14342400:IST:0:7200
|
12
|
+
17193600:IDT:1:10800
|
13
|
+
14342400:IST:0:7200
|
14
|
+
17193600:IDT:1:10800
|
15
|
+
49161600:IST:0:7200
|
16
|
+
8726400:IDDT:1:14400
|
17
|
+
5270400:IDT:1:10800
|
18
|
+
15638400:IST:0:7200
|
19
|
+
15897600:IDT:1:10800
|
20
|
+
14342400:IST:0:7200
|
21
|
+
13132800:IDT:1:10800
|
22
|
+
17107200:IST:0:7200
|
23
|
+
19353600:IDT:1:10800
|
22
24
|
13910400:IST:0:7200
|
23
25
|
15724800:IDT:1:10800
|
24
26
|
15120000:IST:0:7200
|
25
27
|
13305600:IDT:1:10800
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
23587200:IST:0:7200
|
29
|
+
7862400:IDT:1:10800
|
30
|
+
23587200:IST:0:7200
|
31
|
+
7862400:IDT:1:10800
|
32
|
+
22982400:IST:0:7200
|
33
|
+
10281600:IDT:1:10800
|
34
|
+
18144000:IST:0:7200
|
35
|
+
12700800:IDT:1:10800
|
36
|
+
529797600:IST:0:7200
|
35
37
|
8463600:IDT:1:10800
|
36
38
|
16333200:IST:0:7200
|
37
39
|
11487600:IDT:1:10800
|
38
|
-
|
40
|
+
155437200:IST:0:7200
|
39
41
|
3628800:IDT:1:10800
|
40
42
|
114912000:IST:0:7200
|
41
43
|
9676800:IDT:1:10800
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
19958400:IST:0:7200
|
45
|
+
12092400:IDT:1:10800
|
46
|
+
22381200:IST:0:7200
|
45
47
|
9673200:IDT:1:10800
|
46
48
|
19011600:IST:0:7200
|
47
49
|
13042800:IDT:1:10800
|
data/data/PRC
CHANGED
data/data/Pacific/Efate
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
-1829387597:LMT:0:40396
|
2
|
-
|
2
|
+
1954797196:+11:0:39600
|
3
|
+
8467200:+12:1:43200
|
4
|
+
299379600:+11:0:39600
|
5
|
+
15721200:+12:1:43200
|
6
|
+
15728400:+11:0:39600
|
3
7
|
15721200:+12:1:43200
|
4
|
-
18320400:+11:0:39600
|
5
|
-
13129200:+12:1:43200
|
6
8
|
16333200:+11:0:39600
|
7
9
|
15116400:+12:1:43200
|
8
10
|
16333200:+11:0:39600
|
data/data/Pacific/Fiji
CHANGED
data/lib/timezone/parser.rb
CHANGED
@@ -11,28 +11,42 @@ module Timezone
|
|
11
11
|
|
12
12
|
LINE = /\s*(.+)\s*=\s*(.+)\s*isdst=(\d+)\s*gmtoff=([\+\-]*\d+)/
|
13
13
|
|
14
|
-
|
14
|
+
# Bookkeeping files that we do not want to parse.
|
15
|
+
IGNORE = ['leapseconds', 'posixrules', 'tzdata.zi'].freeze
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
def initialize(zoneinfo = ZONEINFO_DIR)
|
19
|
-
@zoneinfo = zoneinfo
|
17
|
+
def initialize(root)
|
18
|
+
@config = Config.new(root)
|
20
19
|
end
|
21
20
|
|
22
21
|
def perform
|
23
22
|
FileUtils.rm_rf('data')
|
24
23
|
|
25
|
-
Dir["#{zoneinfo}
|
24
|
+
Dir["#{@config.zoneinfo}/**/*"].each do |file|
|
26
25
|
next if File.directory?(file)
|
26
|
+
next if file.end_with?('.tab')
|
27
|
+
next if IGNORE.include?(File.basename(file))
|
27
28
|
parse(file)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
32
|
+
# Represents a timezone database config.
|
33
|
+
class Config
|
34
|
+
def initialize(root)
|
35
|
+
@root = root
|
36
|
+
@zoneinfo = File.join(@root, 'usr/share/zoneinfo')
|
37
|
+
@zdump = File.join(@root, 'usr/bin/zdump')
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_reader :root, :zoneinfo, :zdump
|
41
|
+
end
|
42
|
+
|
43
|
+
private_constant :Config
|
44
|
+
|
31
45
|
# Represents a single timezone data file line for a reference timezone.
|
32
46
|
class RefLine
|
33
|
-
def initialize(
|
47
|
+
def initialize(config, file)
|
34
48
|
first =
|
35
|
-
|
49
|
+
`#{config.zdump} -i #{file}`
|
36
50
|
.split("\n")
|
37
51
|
.reject(&:empty?)
|
38
52
|
.reject { |line| line.start_with?('TZ=') }
|
@@ -85,15 +99,15 @@ module Timezone
|
|
85
99
|
private
|
86
100
|
|
87
101
|
def parse(file)
|
88
|
-
zone = file.gsub("#{zoneinfo}/
|
102
|
+
zone = file.gsub("#{@config.zoneinfo}/", '')
|
89
103
|
print "Parsing #{zone}... "
|
90
|
-
data = zdump(
|
104
|
+
data = zdump(file)
|
91
105
|
|
92
106
|
last = 0
|
93
107
|
result = []
|
94
108
|
|
95
109
|
data.split("\n").each do |line|
|
96
|
-
match = line.gsub(
|
110
|
+
match = line.gsub(/^#{file}\s+/, '').match(LINE)
|
97
111
|
next if match.nil?
|
98
112
|
|
99
113
|
line = Line.new(match)
|
@@ -112,14 +126,14 @@ module Timezone
|
|
112
126
|
result << line
|
113
127
|
end
|
114
128
|
|
115
|
-
result << RefLine.new(
|
129
|
+
result << RefLine.new(@config, file) if result.empty?
|
116
130
|
|
117
131
|
write(zone, result)
|
118
132
|
puts 'DONE'
|
119
133
|
end
|
120
134
|
|
121
|
-
def zdump(
|
122
|
-
|
135
|
+
def zdump(file)
|
136
|
+
`#{@config.zdump} -v -c #{MIN_YEAR},#{MAX_YEAR} #{file}`
|
123
137
|
end
|
124
138
|
|
125
139
|
def write(zone, data)
|