timezone 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.markdown +4 -0
- data/data/Africa/Addis_Ababa +5 -3
- data/data/Africa/Asmara +5 -4
- data/data/Africa/Asmera +5 -4
- data/data/Africa/Dar_es_Salaam +5 -4
- data/data/Africa/Djibouti +5 -2
- data/data/Africa/Kampala +5 -5
- data/data/Africa/Mogadishu +5 -4
- data/data/America/Grand_Turk +2 -0
- data/data/Asia/Pyongyang +4 -8
- data/data/Asia/Seoul +21 -14
- data/data/Indian/Antananarivo +5 -4
- data/data/Indian/Comoro +5 -2
- data/data/Indian/Mayotte +5 -2
- data/data/ROK +21 -14
- data/lib/timezone/parser.rb +31 -16
- data/lib/timezone/version.rb +1 -1
- metadata +2 -2
data/CHANGES.markdown
CHANGED
data/data/Africa/Addis_Ababa
CHANGED
data/data/Africa/Asmara
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/Africa/Asmera
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/Africa/Dar_es_Salaam
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/Africa/Djibouti
CHANGED
data/data/Africa/Kampala
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/Africa/Mogadishu
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/America/Grand_Turk
CHANGED
data/data/Asia/Pyongyang
CHANGED
@@ -1,9 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
126232200:KST:0:30600
|
5
|
-
181438200:JCST:0:32400
|
1
|
+
-1948782181:LMT:0:30180
|
2
|
+
118367580:KST:0:30600
|
3
|
+
812590200:JCST:0:32400
|
6
4
|
249177600:JST:0:32400
|
7
|
-
|
8
|
-
233197200:KST:0:28800
|
9
|
-
1606032001:KST:0:32400
|
5
|
+
2109747601:KST:0:32400
|
data/data/Asia/Seoul
CHANGED
@@ -1,16 +1,23 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
126232200:KST:0:30600
|
5
|
-
181438200:JCST:0:32400
|
1
|
+
-1948782473:LMT:0:30472
|
2
|
+
118367872:KST:0:30600
|
3
|
+
812590200:JCST:0:32400
|
6
4
|
250473600:JST:0:32400
|
7
5
|
269222400:KST:0:32400
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
35425800:KST:0:30600
|
7
|
+
10969200:KDT:1:34200
|
8
|
+
21949200:KST:0:30600
|
9
|
+
11487600:KDT:1:34200
|
10
|
+
18752400:KST:0:30600
|
11
|
+
12092400:KDT:1:34200
|
12
|
+
19357200:KST:0:30600
|
13
|
+
12092400:KDT:1:34200
|
14
|
+
19357200:KST:0:30600
|
15
|
+
12092400:KDT:1:34200
|
16
|
+
19357200:KST:0:30600
|
17
|
+
12092400:KDT:1:34200
|
18
|
+
28170000:KST:0:30600
|
19
|
+
812511000:KST:0:32400
|
20
|
+
13305600:KDT:1:36000
|
21
|
+
18144000:KST:0:32400
|
22
|
+
13305600:KDT:1:36000
|
23
|
+
748767601:KST:0:32400
|
data/data/Indian/Antananarivo
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
-1309746437:LMT:0:8836
|
2
|
+
47431636:EAT:0:10800
|
3
|
+
315534600:BEAT:0:9000
|
4
|
+
631151100:BEAUT:0:9900
|
5
|
+
1656729901:EAT:0:10800
|
data/data/Indian/Comoro
CHANGED
data/data/Indian/Mayotte
CHANGED
data/data/ROK
CHANGED
@@ -1,16 +1,23 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
126232200:KST:0:30600
|
5
|
-
181438200:JCST:0:32400
|
1
|
+
-1948782473:LMT:0:30472
|
2
|
+
118367872:KST:0:30600
|
3
|
+
812590200:JCST:0:32400
|
6
4
|
250473600:JST:0:32400
|
7
5
|
269222400:KST:0:32400
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
35425800:KST:0:30600
|
7
|
+
10969200:KDT:1:34200
|
8
|
+
21949200:KST:0:30600
|
9
|
+
11487600:KDT:1:34200
|
10
|
+
18752400:KST:0:30600
|
11
|
+
12092400:KDT:1:34200
|
12
|
+
19357200:KST:0:30600
|
13
|
+
12092400:KDT:1:34200
|
14
|
+
19357200:KST:0:30600
|
15
|
+
12092400:KDT:1:34200
|
16
|
+
19357200:KST:0:30600
|
17
|
+
12092400:KDT:1:34200
|
18
|
+
28170000:KST:0:30600
|
19
|
+
812511000:KST:0:32400
|
20
|
+
13305600:KDT:1:36000
|
21
|
+
18144000:KST:0:32400
|
22
|
+
13305600:KDT:1:36000
|
23
|
+
748767601:KST:0:32400
|
data/lib/timezone/parser.rb
CHANGED
@@ -3,7 +3,6 @@ require 'time'
|
|
3
3
|
module Timezone
|
4
4
|
class Parser
|
5
5
|
LINE = /\s*(.+)\s*=\s*(.+)\s*isdst=(\d+)\s*gmtoff=([\+\-]*\d+)/
|
6
|
-
FORMAT = '%a %b %e %H:%M:%S %Y %Z'
|
7
6
|
|
8
7
|
ZONEINFO_DIR = '/usr/share/zoneinfo'
|
9
8
|
|
@@ -22,6 +21,27 @@ module Timezone
|
|
22
21
|
|
23
22
|
private
|
24
23
|
|
24
|
+
class Line
|
25
|
+
attr_accessor :source, :name, :dst, :offset
|
26
|
+
|
27
|
+
SOURCE_FORMAT = '%a %b %e %H:%M:%S %Y %Z'
|
28
|
+
|
29
|
+
def initialize(match)
|
30
|
+
self.source = Time.strptime(match[1]+'C', SOURCE_FORMAT).to_i
|
31
|
+
self.name = match[2].split(' ').last
|
32
|
+
self.dst = match[3].to_i
|
33
|
+
self.offset = match[4].to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def ==(other)
|
37
|
+
name == other.name && dst == other.dst && offset == other.offset
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_s
|
41
|
+
[source, name, dst, offset].join(':')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
25
45
|
def parse(file)
|
26
46
|
zone = file.gsub("#{zoneinfo}/right/",'')
|
27
47
|
print "Parsing #{zone}... "
|
@@ -29,30 +49,25 @@ module Timezone
|
|
29
49
|
|
30
50
|
last = 0
|
31
51
|
result = []
|
52
|
+
|
32
53
|
data.split("\n").each do |line|
|
33
54
|
match = line.gsub('right/'+zone+' ','').match(LINE)
|
34
55
|
next if match.nil?
|
35
56
|
|
36
|
-
|
37
|
-
name = match[2].split(' ').last
|
38
|
-
dst = match[3].to_i
|
39
|
-
offset = match[4].to_i
|
57
|
+
line = Line.new(match)
|
40
58
|
|
41
59
|
# If we're just repeating info, pop the last one and
|
42
60
|
# add an inclusive rule.
|
43
|
-
if result.last &&
|
44
|
-
result.last
|
45
|
-
result.
|
46
|
-
result.last[3] == offset
|
47
|
-
last -= result.last[0]
|
48
|
-
result.pop
|
61
|
+
if result.last && result.last == line
|
62
|
+
last -= result.last.source
|
63
|
+
result.pop
|
49
64
|
end
|
50
65
|
|
51
|
-
temp = source
|
52
|
-
source = source - last
|
66
|
+
temp = line.source
|
67
|
+
line.source = line.source - last
|
53
68
|
last = temp
|
54
69
|
|
55
|
-
result <<
|
70
|
+
result << line
|
56
71
|
end
|
57
72
|
|
58
73
|
write(zone, result)
|
@@ -60,13 +75,13 @@ module Timezone
|
|
60
75
|
end
|
61
76
|
|
62
77
|
def zdump(zone)
|
63
|
-
|
78
|
+
`zdump -v right/#{zone}`
|
64
79
|
end
|
65
80
|
|
66
81
|
def write(zone, data)
|
67
82
|
system("mkdir -p data/#{File.dirname(zone)}")
|
68
83
|
f = File.open("data/#{zone}", 'w')
|
69
|
-
f.write(data.map
|
84
|
+
f.write(data.map(&:to_s).join("\n"))
|
70
85
|
f.close
|
71
86
|
end
|
72
87
|
end
|
data/lib/timezone/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timezone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -721,7 +721,7 @@ rubyforge_project: timezone
|
|
721
721
|
rubygems_version: 1.8.23.2
|
722
722
|
signing_key:
|
723
723
|
specification_version: 3
|
724
|
-
summary: timezone-0.3.
|
724
|
+
summary: timezone-0.3.5
|
725
725
|
test_files:
|
726
726
|
- test/data/Helsinki_rules_without_timestamps.json
|
727
727
|
- test/data/asia
|