timezone 1.3.6 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGES.markdown +20 -0
  4. data/CONTRIBUTING.markdown +8 -2
  5. data/Rakefile +3 -1
  6. data/benchmark.rb +16 -29
  7. data/data/Africa/Accra +61 -47
  8. data/data/Africa/Addis_Ababa +5 -4
  9. data/data/Africa/Algiers +2 -2
  10. data/data/Africa/Asmara +5 -4
  11. data/data/Africa/Asmera +5 -4
  12. data/data/Africa/Bangui +4 -1
  13. data/data/Africa/Brazzaville +4 -1
  14. data/data/Africa/Casablanca +11 -11
  15. data/data/Africa/Dar_es_Salaam +5 -4
  16. data/data/Africa/Djibouti +5 -4
  17. data/data/Africa/Douala +4 -1
  18. data/data/Africa/El_Aaiun +11 -11
  19. data/data/Africa/Kampala +5 -4
  20. data/data/Africa/Kinshasa +4 -1
  21. data/data/Africa/Lagos +4 -1
  22. data/data/Africa/Libreville +4 -1
  23. data/data/Africa/Luanda +4 -1
  24. data/data/Africa/Malabo +4 -1
  25. data/data/Africa/Mogadishu +5 -4
  26. data/data/Africa/Nairobi +5 -4
  27. data/data/Africa/Niamey +4 -1
  28. data/data/Africa/Porto-Novo +4 -1
  29. data/data/America/Belize +44 -1
  30. data/data/America/Dawson +2 -38
  31. data/data/America/Grand_Turk +1 -2
  32. data/data/America/Nassau +6 -1
  33. data/data/America/Nuuk +120 -0
  34. data/data/America/Whitehorse +2 -38
  35. data/data/Antarctica/Casey +6 -1
  36. data/data/Antarctica/Macquarie +58 -3
  37. data/data/Asia/Chongqing +3 -1
  38. data/data/Asia/Chungking +3 -1
  39. data/data/Asia/Gaza +58 -56
  40. data/data/Asia/Harbin +3 -1
  41. data/data/Asia/Hebron +58 -56
  42. data/data/Asia/Jerusalem +34 -32
  43. data/data/Asia/Shanghai +3 -1
  44. data/data/Asia/Tel_Aviv +34 -32
  45. data/data/Atlantic/Bermuda +29 -2
  46. data/data/Australia/ACT +9 -9
  47. data/data/Australia/Adelaide +9 -9
  48. data/data/Australia/Brisbane +9 -9
  49. data/data/Australia/Broken_Hill +9 -9
  50. data/data/Australia/Canberra +9 -9
  51. data/data/Australia/Currie +22 -10
  52. data/data/Australia/Darwin +8 -8
  53. data/data/Australia/Eucla +7 -7
  54. data/data/Australia/Hobart +12 -8
  55. data/data/Australia/Lindeman +9 -9
  56. data/data/Australia/Melbourne +9 -9
  57. data/data/Australia/NSW +9 -9
  58. data/data/Australia/North +8 -8
  59. data/data/Australia/Perth +7 -7
  60. data/data/Australia/Queensland +9 -9
  61. data/data/Australia/South +9 -9
  62. data/data/Australia/Sydney +9 -9
  63. data/data/Australia/Tasmania +12 -8
  64. data/data/Australia/Victoria +9 -9
  65. data/data/Australia/West +7 -7
  66. data/data/Australia/Yancowinna +9 -9
  67. data/data/Canada/Yukon +2 -38
  68. data/data/Europe/Budapest +24 -24
  69. data/data/Europe/Monaco +3 -3
  70. data/data/Europe/Paris +3 -3
  71. data/data/Europe/Volgograd +2 -1
  72. data/data/Indian/Antananarivo +5 -4
  73. data/data/Indian/Comoro +5 -4
  74. data/data/Indian/Mahe +1 -1
  75. data/data/Indian/Mayotte +5 -4
  76. data/data/Israel +34 -32
  77. data/data/PRC +3 -1
  78. data/data/Pacific/Efate +5 -3
  79. data/data/Pacific/Fiji +2 -2
  80. data/lib/timezone/parser.rb +28 -14
  81. data/lib/timezone/version.rb +1 -1
  82. data/test/timezone/test_zone.rb +4 -4
  83. data/timezone.gemspec +0 -2
  84. metadata +8 -8
  85. data/data/US/Pacific-New +0 -189
@@ -1,13 +1,13 @@
1
1
  -2364111593:LMT:0:34792
2
- 691544452:AEST:0:36000
3
- 7174740:AEDT:1:39600
4
- 781750800:AEST:0:36000
5
- 7513200:AEDT:1:39600
6
- 15728400:AEST:0:36000
7
- 15721200:AEDT:1:39600
8
- 16333200:AEST:0:36000
9
- 15116400:AEDT:1:39600
10
- 870915600:AEST:0:36000
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
@@ -1,11 +1,11 @@
1
1
  -2337925405:LMT:0:27804
2
- 665365464:AWST:0:28800
3
- 7174740:AWDT:1:32400
4
- 781750800:AWST:0:28800
5
- 7513200:AWDT:1:32400
6
- 15728400:AWST:0:28800
7
- 15721200:AWDT:1:32400
8
- 996714000:AWST:0:28800
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
@@ -1,15 +1,15 @@
1
1
  -2364110749:LMT:0:33948
2
2
  49159548:AEST:0:36000
3
3
  84762000:ACST:0:32400
4
- 557623860:ACST:0:34200
5
- 7174740:ACDT:1:37800
6
- 781750800:ACST:0:34200
7
- 7513200:ACDT:1:37800
8
- 15728400:ACST:0:34200
9
- 15721200:ACDT:1:37800
10
- 16333200:ACST:0:34200
11
- 15116400:ACDT:1:37800
12
- 870915600:ACST:0:34200
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
@@ -90,41 +90,5 @@
90
90
  10890000:PST:0:-28800
91
91
  20559600:PDT:1:-25200
92
92
  10890000:PST:0:-28800
93
- 20559600:PDT:1:-25200
94
- 11494800:PST:0:-28800
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
@@ -1,47 +1,47 @@
1
- -2500938981:LMT:0:4580
2
- 807232580:CET:0:3600
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
- 16938000:CET:0:3600
7
- 14511600:CEST:1:7200
8
- 18234000:CET:0:3600
9
- 19263600:CEST:1:7200
10
- 674431200:CET:0:3600
11
- 49514400:CEST:1:7200
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
- 15811200:CEST:1:7200
18
- 12970800:CET:0:3600
19
- 16329600:CEST:1:7200
20
- 15724800:CET:0:3600
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
- 17020800:CET:0:3600
27
- 16329600:CEST:1:7200
28
- 113004000:CET:0:3600
28
+ 146354400:CET:0:3600
29
29
  11487600:CEST:1:7200
30
- 20048400:CET:0:3600
31
- 11487600:CEST:1:7200
32
- 21085200:CET:0:3600
33
- 10278000:CEST:1:7200
34
- 21175200:CET:0:3600
35
- 10285200:CEST:1:7200
36
- 710636400:CET:0:3600
37
- 15123600:CEST:1:7200
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
- 15724800:CET:0:3600
44
+ 15732000:CET:0:3600
45
45
  16329600:CEST:1:7200
46
46
  15724800:CET:0:3600
47
47
  15724800:CEST:1:7200
@@ -1,6 +1,6 @@
1
- -2486680173:LMT:0:1772
2
- 630721211:PMT:0:561
3
- 166144161:WET:0:0
1
+ -2448318573:LMT:0:1772
2
+ 593914811:PMT:0:561
3
+ 164588961:WET:0:0
4
4
  9417600:WEST:1:3600
5
5
  15033600:WET:0:0
6
6
  17020800:WEST:1:3600
@@ -1,6 +1,6 @@
1
- -2486678902:LMT:0:561
2
- 630720000:PMT:0:561
3
- 166144101:WET:0:0
1
+ -2486592562:LMT:0:561
2
+ 630633600:PMT:0:561
3
+ 166144161:WET:0:0
4
4
  9417600:WEST:1:3600
5
5
  15033600:WET:0:0
6
6
  17020800:WEST:1:3600
@@ -62,4 +62,5 @@
62
62
  12700800:+03:0:10800
63
63
  113094000:+04:0:14400
64
64
  126406800:+03:0:10800
65
- 1:+04:0:14400
65
+ 68338800:+04:0:14400
66
+ 1:+03:0:10800
@@ -1,5 +1,6 @@
1
- -1309746437:LMT:0:8836
2
- 47431636:EAT:0:10800
3
- 315534600:+0230:0:9000
4
- 631151100:+0245:0:9900
1
+ -1946168837:LMT:0:8836
2
+ 636422236:+0230:0:9000
3
+ 47777400:EAT:0:10800
4
+ 220581000:+0230:0:9000
5
+ 176082300:+0245:0:9900
5
6
  1:EAT:0:10800
@@ -1,5 +1,6 @@
1
- -1309746437:LMT:0:8836
2
- 47431636:EAT:0:10800
3
- 315534600:+0230:0:9000
4
- 631151100:+0245:0:9900
1
+ -1946168837:LMT:0:8836
2
+ 636422236:+0230:0:9000
3
+ 47777400:EAT:0:10800
4
+ 220581000:+0230:0:9000
5
+ 176082300:+0245:0:9900
5
6
  1:EAT:0:10800
@@ -1,2 +1,2 @@
1
- -2006653309:LMT:0:13308
1
+ -1988163709:LMT:0:13308
2
2
  1:+04:0:14400
@@ -1,5 +1,6 @@
1
- -1309746437:LMT:0:8836
2
- 47431636:EAT:0:10800
3
- 315534600:+0230:0:9000
4
- 631151100:+0245:0:9900
1
+ -1946168837:LMT:0:8836
2
+ 636422236:+0230:0:9000
3
+ 47777400:EAT:0:10800
4
+ 220581000:+0230:0:9000
5
+ 176082300:+0245:0:9900
5
6
  1:EAT:0:10800
@@ -1,47 +1,49 @@
1
1
  -2840149255:LMT:0:8454
2
2
  1199145614:JMT:0:8440
3
- 707358040:IST:0:7200
4
- 76287600:IDT:1:10800
5
- 13057200:IST:0:7200
6
- 18478800:IDT:1:10800
7
- 13136400:IST:0:7200
8
- 18486000:IDT:1:10800
9
- 14346000:IST:0:7200
10
- 17197200:IDT:1:10800
11
- 14346000:IST:0:7200
12
- 17182800:IDT:1:10800
13
- 49165200:IST:0:7200
14
- 8719200:IDDT:1:14400
15
- 5281200:IDT:1:10800
16
- 15634800:IST:0:7200
17
- 15901200:IDT:1:10800
18
- 14338800:IST:0:7200
19
- 13140000:IDT:1:10800
20
- 17100000:IST:0:7200
21
- 19360800:IDT:1:10800
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
- 23580000:IST:0:7200
27
- 7858800:IDT:1:10800
28
- 23511600:IST:0:7200
29
- 7938000:IDT:1:10800
30
- 22986000:IST:0:7200
31
- 10288800:IDT:1:10800
32
- 18230400:IST:0:7200
33
- 12603600:IDT:1:10800
34
- 529808400:IST:0:7200
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
- 155350800:IST:0:7200
40
+ 155437200:IST:0:7200
39
41
  3628800:IDT:1:10800
40
42
  114912000:IST:0:7200
41
43
  9676800:IDT:1:10800
42
- 20044800:IST:0:7200
43
- 13302000:IDT:1:10800
44
- 21171600:IST:0:7200
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
@@ -1,5 +1,7 @@
1
1
  -2177481944:LMT:0:29143
2
- 1243814743:CST:0:28800
2
+ 576806743:CST:0:28800
3
+ 14770800:CDT:1:32400
4
+ 652237200:CST:0:28800
3
5
  11574000:CDT:1:32400
4
6
  13222800:CST:0:28800
5
7
  20041200:CDT:1:32400
@@ -1,8 +1,10 @@
1
1
  -1829387597:LMT:0:40396
2
- 2262643996:+11:0:39600
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
@@ -25,8 +25,8 @@
25
25
  6048000:+13:1:46800
26
26
  26006400:+12:0:43200
27
27
  5443200:+13:1:46800
28
- 26006400:+12:0:43200
29
- 6048000:+13:1:46800
28
+ 29635200:+12:0:43200
29
+ 2419200:+13:1:46800
30
30
  26006400:+12:0:43200
31
31
  5443200:+13:1:46800
32
32
  26006400:+12:0:43200
@@ -11,28 +11,42 @@ module Timezone
11
11
 
12
12
  LINE = /\s*(.+)\s*=\s*(.+)\s*isdst=(\d+)\s*gmtoff=([\+\-]*\d+)/
13
13
 
14
- ZONEINFO_DIR = '/usr/share/zoneinfo'.freeze
14
+ # Bookkeeping files that we do not want to parse.
15
+ IGNORE = ['leapseconds', 'posixrules', 'tzdata.zi'].freeze
15
16
 
16
- attr_reader :zoneinfo
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}/posix/**/*"].each do |file|
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(zone)
47
+ def initialize(config, file)
34
48
  first =
35
- `zdump -i posix/#{zone}`
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}/posix/", '')
102
+ zone = file.gsub("#{@config.zoneinfo}/", '')
89
103
  print "Parsing #{zone}... "
90
- data = zdump(zone)
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('posix/' + zone + ' ', '').match(LINE)
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(zone) if result.empty?
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(zone)
122
- `zdump -v -c #{MIN_YEAR},#{MAX_YEAR} posix/#{zone}`
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)