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 CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.3.5+
2
+
3
+ * `0.3.5` - Updated with tzdata-2014j-1. (panthomakos)
4
+
1
5
  # 0.3.4
2
6
 
3
7
  * Added support for Google Timezone API. (amnesia7)
@@ -1,3 +1,5 @@
1
- -3155682889:LMT:0:9288
2
- 2093471968:ADMT:0:9320
3
- 2403311721:EAT:0:10800
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/Asmara CHANGED
@@ -1,4 +1,5 @@
1
- -3155682933:LMT:0:9332
2
- 631152000:AMT:0:9332
3
- 1462320012:ADMT:0:9320
4
- 2403311721:EAT:0:10800
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
- -3155682933:LMT:0:9332
2
- 631152000:AMT:0:9332
3
- 1462320012:ADMT:0:9320
4
- 2403311721:EAT:0:10800
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
@@ -1,4 +1,5 @@
1
- -1230777429:LMT:0:9428
2
- 536456228:EAT:0:10800
3
- 410314500:BEAUT:0:9900
4
- 1625107501:EAT:0:10800
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
@@ -1,2 +1,5 @@
1
- -1846291957:LMT:0:10356
2
- 3187392757:EAT:0:10800
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/Kampala CHANGED
@@ -1,5 +1,5 @@
1
- -1309745381:LMT:0:7780
2
- 47430580:EAT:0:10800
3
- 567995400:BEAT:0:9000
4
- 284082300:BEAUT:0:9900
5
- 1751337901:EAT:0:10800
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
@@ -1,4 +1,5 @@
1
- -2403572489:LMT:0:10888
2
- 1172793688:EAT:0:10800
3
- 820542600:BEAT:0:9000
4
- 1751337001:EAT:0:10800
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
@@ -72,4 +72,6 @@
72
72
  20559600:EDT:1:-14400
73
73
  10890000:EST:0:-18000
74
74
  20559600:EDT:1:-14400
75
+ 10890000:EST:0:-18000
76
+ 20559600:EDT:1:-14400
75
77
  1:AST:0:-14400
data/data/Asia/Pyongyang CHANGED
@@ -1,9 +1,5 @@
1
- -2524551781:LMT:0:30180
2
- 470620380:KST:0:30600
3
- 728436600:JCST:0:32400
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
- 270518400:KST:0:32400
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
- -2524552073:LMT:0:30472
2
- 470620672:KST:0:30600
3
- 728436600:JCST:0:32400
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
- 194144400:KST:0:28800
9
- 10450800:KDT:1:32400
10
- 28602000:KST:0:28800
11
- 225415800:KST:0:30600
12
- 587086200:KST:0:32400
13
- 13302000:KDT:1:36000
14
- 18147600:KST:0:32400
15
- 13302000:KDT:1:36000
16
- 748778401:KST:0:32400
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
@@ -1,4 +1,5 @@
1
- -1846293005:LMT:0:11404
2
- 1346368204:EAT:0:10800
3
- 7862400:EAST:1:14400
4
- 1833163201:EAT:0:10800
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
@@ -1,2 +1,5 @@
1
- -1846291985:LMT:0:10384
2
- 3187392785:EAT:0:10800
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/Mayotte CHANGED
@@ -1,2 +1,5 @@
1
- -1846292457:LMT:0:10856
2
- 3187393257:EAT:0:10800
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/ROK CHANGED
@@ -1,16 +1,23 @@
1
- -2524552073:LMT:0:30472
2
- 470620672:KST:0:30600
3
- 728436600:JCST:0:32400
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
- 194144400:KST:0:28800
9
- 10450800:KDT:1:32400
10
- 28602000:KST:0:28800
11
- 225415800:KST:0:30600
12
- 587086200:KST:0:32400
13
- 13302000:KDT:1:36000
14
- 18147600:KST:0:32400
15
- 13302000:KDT:1:36000
16
- 748778401:KST:0:32400
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
@@ -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
- source = Time.strptime(match[1]+'C', FORMAT).to_i
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[1] == name &&
45
- result.last[2] == dst &&
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 << [source, name, dst, offset]
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
- return `zdump -v right/#{zone}`
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{ |k| k.join(':') }.join("\n"))
84
+ f.write(data.map(&:to_s).join("\n"))
70
85
  f.close
71
86
  end
72
87
  end
@@ -1,3 +1,3 @@
1
1
  module Timezone
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
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
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.4
724
+ summary: timezone-0.3.5
725
725
  test_files:
726
726
  - test/data/Helsinki_rules_without_timestamps.json
727
727
  - test/data/asia