timezone 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.markdown +7 -0
- data/CONTRIBUTING.markdown +4 -6
- data/data/Africa/Casablanca +2 -0
- data/data/Africa/El_Aaiun +2 -0
- data/data/America/Campo_Grande +1 -40
- data/data/America/Cuiaba +1 -40
- data/data/America/Sao_Paulo +1 -40
- data/data/Asia/Gaza +40 -40
- data/data/Asia/Hebron +40 -40
- data/data/Asia/Hong_Kong +18 -18
- data/data/Brazil/East +1 -40
- data/data/Europe/Rome +2 -2
- data/data/Europe/San_Marino +2 -2
- data/data/Europe/Vatican +2 -2
- data/data/Hongkong +18 -18
- data/lib/timezone/loader.rb +6 -3
- data/lib/timezone/version.rb +1 -1
- data/lib/timezone/zone.rb +17 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6cefa8086edeba989ff9c7867f02a412aac2699310cffc99b0c72e2d2c0f0cf
|
4
|
+
data.tar.gz: f7b282957223d3f3a70bd503d0d9a8c12a15c0af93a6254827bbfc14ee535caa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 841cadbaed9b9d1e1c0b20fad00d6c5d9eb5fac1ba6ef5afd48cd8a2a0299a215ab10caba1a4d2174a49377b839909bd8c4c9dbf78c8d90bd06f9812f39d2f98
|
7
|
+
data.tar.gz: b243f38c2bd095d6648042357133c73786899085e3a38c4d201d3cb3cb1646c00114d2be8a903bdba7edfe705e10ff18956fb188d4213ed00cfc96711295cd20
|
data/CHANGES.markdown
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# master (unreleased)
|
2
2
|
|
3
|
+
# 1.3.5
|
4
|
+
|
5
|
+
* Remove `@rules` from `Zone`'s `Marshall::dump`. ([@panthomakos][])
|
6
|
+
* Updated with `tzdata-2019b-1`. ([@panthomakos][])
|
7
|
+
|
3
8
|
# 1.3.4
|
4
9
|
|
5
10
|
* Updated with `tzdata-2019a-1`. (panthomakos)
|
@@ -209,3 +214,5 @@
|
|
209
214
|
# 0.1.2
|
210
215
|
|
211
216
|
* Fixed `#utc_offset` rule selection. (natemueller)
|
217
|
+
|
218
|
+
[@panthomakos]: https://github.com/panthomakos
|
data/CONTRIBUTING.markdown
CHANGED
@@ -6,12 +6,10 @@
|
|
6
6
|
|
7
7
|
# How to Acquire New TZData Information
|
8
8
|
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
the local `data` directory.
|
9
|
+
* Ensure system `tzdata` package is up to date with most recent release from [IANA](http://www.iana.org/time-zones).
|
10
|
+
* Run `bundle exec rake parse` to parse files in `posix/` directory into the local `data` directory.
|
11
|
+
* Commit changes. For an example, see [this commit](https://github.com/panthomakos/timezone/commit/5815112d7a6c8740844189db0f05281e9c98f58f).
|
13
12
|
|
14
13
|
# Notes
|
15
14
|
|
16
|
-
* How to read TZData IANA source files:
|
17
|
-
http://www.cstdbill.com/tzdb/tz-how-to.html
|
15
|
+
* How to read TZData IANA source files: http://www.cstdbill.com/tzdb/tz-how-to.html
|
data/data/Africa/Casablanca
CHANGED
data/data/Africa/El_Aaiun
CHANGED
data/data/America/Campo_Grande
CHANGED
@@ -89,43 +89,4 @@
|
|
89
89
|
10882800:-03:1:-10800
|
90
90
|
22381200:-04:0:-14400
|
91
91
|
9068400:-03:1:-10800
|
92
|
-
|
93
|
-
9068400:-03:1:-10800
|
94
|
-
22381200:-04:0:-14400
|
95
|
-
9673200:-03:1:-10800
|
96
|
-
22381200:-04:0:-14400
|
97
|
-
9068400:-03:1:-10800
|
98
|
-
22381200:-04:0:-14400
|
99
|
-
9673200:-03:1:-10800
|
100
|
-
21776400:-04:0:-14400
|
101
|
-
9068400:-03:1:-10800
|
102
|
-
22381200:-04:0:-14400
|
103
|
-
9068400:-03:1:-10800
|
104
|
-
22381200:-04:0:-14400
|
105
|
-
9673200:-03:1:-10800
|
106
|
-
21776400:-04:0:-14400
|
107
|
-
9673200:-03:1:-10800
|
108
|
-
22381200:-04:0:-14400
|
109
|
-
9068400:-03:1:-10800
|
110
|
-
22381200:-04:0:-14400
|
111
|
-
9068400:-03:1:-10800
|
112
|
-
22381200:-04:0:-14400
|
113
|
-
9068400:-03:1:-10800
|
114
|
-
22381200:-04:0:-14400
|
115
|
-
9068400:-03:1:-10800
|
116
|
-
22381200:-04:0:-14400
|
117
|
-
9068400:-03:1:-10800
|
118
|
-
22986000:-04:0:-14400
|
119
|
-
9068400:-03:1:-10800
|
120
|
-
22381200:-04:0:-14400
|
121
|
-
9673200:-03:1:-10800
|
122
|
-
21776400:-04:0:-14400
|
123
|
-
9068400:-03:1:-10800
|
124
|
-
22381200:-04:0:-14400
|
125
|
-
9068400:-03:1:-10800
|
126
|
-
22381200:-04:0:-14400
|
127
|
-
9673200:-03:1:-10800
|
128
|
-
21776400:-04:0:-14400
|
129
|
-
9673200:-03:1:-10800
|
130
|
-
22381200:-04:0:-14400
|
131
|
-
1:-03:1:-10800
|
92
|
+
1:-04:0:-14400
|
data/data/America/Cuiaba
CHANGED
@@ -87,43 +87,4 @@
|
|
87
87
|
10882800:-03:1:-10800
|
88
88
|
22381200:-04:0:-14400
|
89
89
|
9068400:-03:1:-10800
|
90
|
-
|
91
|
-
9068400:-03:1:-10800
|
92
|
-
22381200:-04:0:-14400
|
93
|
-
9673200:-03:1:-10800
|
94
|
-
22381200:-04:0:-14400
|
95
|
-
9068400:-03:1:-10800
|
96
|
-
22381200:-04:0:-14400
|
97
|
-
9673200:-03:1:-10800
|
98
|
-
21776400:-04:0:-14400
|
99
|
-
9068400:-03:1:-10800
|
100
|
-
22381200:-04:0:-14400
|
101
|
-
9068400:-03:1:-10800
|
102
|
-
22381200:-04:0:-14400
|
103
|
-
9673200:-03:1:-10800
|
104
|
-
21776400:-04:0:-14400
|
105
|
-
9673200:-03:1:-10800
|
106
|
-
22381200:-04:0:-14400
|
107
|
-
9068400:-03:1:-10800
|
108
|
-
22381200:-04:0:-14400
|
109
|
-
9068400:-03:1:-10800
|
110
|
-
22381200:-04:0:-14400
|
111
|
-
9068400:-03:1:-10800
|
112
|
-
22381200:-04:0:-14400
|
113
|
-
9068400:-03:1:-10800
|
114
|
-
22381200:-04:0:-14400
|
115
|
-
9068400:-03:1:-10800
|
116
|
-
22986000:-04:0:-14400
|
117
|
-
9068400:-03:1:-10800
|
118
|
-
22381200:-04:0:-14400
|
119
|
-
9673200:-03:1:-10800
|
120
|
-
21776400:-04:0:-14400
|
121
|
-
9068400:-03:1:-10800
|
122
|
-
22381200:-04:0:-14400
|
123
|
-
9068400:-03:1:-10800
|
124
|
-
22381200:-04:0:-14400
|
125
|
-
9673200:-03:1:-10800
|
126
|
-
21776400:-04:0:-14400
|
127
|
-
9673200:-03:1:-10800
|
128
|
-
22381200:-04:0:-14400
|
129
|
-
1:-03:1:-10800
|
90
|
+
1:-04:0:-14400
|
data/data/America/Sao_Paulo
CHANGED
@@ -89,43 +89,4 @@
|
|
89
89
|
10882800:-02:1:-7200
|
90
90
|
22381200:-03:0:-10800
|
91
91
|
9068400:-02:1:-7200
|
92
|
-
|
93
|
-
9068400:-02:1:-7200
|
94
|
-
22381200:-03:0:-10800
|
95
|
-
9673200:-02:1:-7200
|
96
|
-
22381200:-03:0:-10800
|
97
|
-
9068400:-02:1:-7200
|
98
|
-
22381200:-03:0:-10800
|
99
|
-
9673200:-02:1:-7200
|
100
|
-
21776400:-03:0:-10800
|
101
|
-
9068400:-02:1:-7200
|
102
|
-
22381200:-03:0:-10800
|
103
|
-
9068400:-02:1:-7200
|
104
|
-
22381200:-03:0:-10800
|
105
|
-
9673200:-02:1:-7200
|
106
|
-
21776400:-03:0:-10800
|
107
|
-
9673200:-02:1:-7200
|
108
|
-
22381200:-03:0:-10800
|
109
|
-
9068400:-02:1:-7200
|
110
|
-
22381200:-03:0:-10800
|
111
|
-
9068400:-02:1:-7200
|
112
|
-
22381200:-03:0:-10800
|
113
|
-
9068400:-02:1:-7200
|
114
|
-
22381200:-03:0:-10800
|
115
|
-
9068400:-02:1:-7200
|
116
|
-
22381200:-03:0:-10800
|
117
|
-
9068400:-02:1:-7200
|
118
|
-
22986000:-03:0:-10800
|
119
|
-
9068400:-02:1:-7200
|
120
|
-
22381200:-03:0:-10800
|
121
|
-
9673200:-02:1:-7200
|
122
|
-
21776400:-03:0:-10800
|
123
|
-
9068400:-02:1:-7200
|
124
|
-
22381200:-03:0:-10800
|
125
|
-
9068400:-02:1:-7200
|
126
|
-
22381200:-03:0:-10800
|
127
|
-
9673200:-02:1:-7200
|
128
|
-
21776400:-03:0:-10800
|
129
|
-
9673200:-02:1:-7200
|
130
|
-
22381200:-03:0:-10800
|
131
|
-
1:-02:1:-7200
|
92
|
+
1:-03:0:-10800
|
data/data/Asia/Gaza
CHANGED
@@ -108,44 +108,44 @@
|
|
108
108
|
18745200:EEST:1:10800
|
109
109
|
12704400:EET:0:7200
|
110
110
|
18745200:EEST:1:10800
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
111
|
+
13219200:EET:0:7200
|
112
|
+
18230400:EEST:1:10800
|
113
|
+
13219200:EET:0:7200
|
114
|
+
18835200:EEST:1:10800
|
115
|
+
12614400:EET:0:7200
|
116
|
+
18835200:EEST:1:10800
|
117
|
+
12614400:EET:0:7200
|
118
|
+
18835200:EEST:1:10800
|
119
|
+
13219200:EET:0:7200
|
120
|
+
18230400:EEST:1:10800
|
121
|
+
13219200:EET:0:7200
|
122
|
+
18230400:EEST:1:10800
|
123
|
+
13219200:EET:0:7200
|
124
|
+
18230400:EEST:1:10800
|
125
|
+
13219200:EET:0:7200
|
126
|
+
18835200:EEST:1:10800
|
127
|
+
12614400:EET:0:7200
|
128
|
+
18835200:EEST:1:10800
|
129
|
+
13219200:EET:0:7200
|
130
|
+
18230400:EEST:1:10800
|
131
|
+
13219200:EET:0:7200
|
132
|
+
18230400:EEST:1:10800
|
133
|
+
13219200:EET:0:7200
|
134
|
+
18230400:EEST:1:10800
|
135
|
+
13219200:EET:0:7200
|
136
|
+
18230400:EEST:1:10800
|
137
|
+
13219200:EET:0:7200
|
138
|
+
18835200:EEST:1:10800
|
139
|
+
12614400:EET:0:7200
|
140
|
+
18835200:EEST:1:10800
|
141
|
+
13219200:EET:0:7200
|
142
|
+
18230400:EEST:1:10800
|
143
|
+
13219200:EET:0:7200
|
144
|
+
18230400:EEST:1:10800
|
145
|
+
13219200:EET:0:7200
|
146
|
+
18230400:EEST:1:10800
|
147
|
+
13219200:EET:0:7200
|
148
|
+
18835200:EEST:1:10800
|
149
|
+
12614400:EET:0:7200
|
150
|
+
18835200:EEST:1:10800
|
151
151
|
1:EET:0:7200
|
data/data/Asia/Hebron
CHANGED
@@ -110,44 +110,44 @@
|
|
110
110
|
18745200:EEST:1:10800
|
111
111
|
12704400:EET:0:7200
|
112
112
|
18745200:EEST:1:10800
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
113
|
+
13219200:EET:0:7200
|
114
|
+
18230400:EEST:1:10800
|
115
|
+
13219200:EET:0:7200
|
116
|
+
18835200:EEST:1:10800
|
117
|
+
12614400:EET:0:7200
|
118
|
+
18835200:EEST:1:10800
|
119
|
+
12614400:EET:0:7200
|
120
|
+
18835200:EEST:1:10800
|
121
|
+
13219200:EET:0:7200
|
122
|
+
18230400:EEST:1:10800
|
123
|
+
13219200:EET:0:7200
|
124
|
+
18230400:EEST:1:10800
|
125
|
+
13219200:EET:0:7200
|
126
|
+
18230400:EEST:1:10800
|
127
|
+
13219200:EET:0:7200
|
128
|
+
18835200:EEST:1:10800
|
129
|
+
12614400:EET:0:7200
|
130
|
+
18835200:EEST:1:10800
|
131
|
+
13219200:EET:0:7200
|
132
|
+
18230400:EEST:1:10800
|
133
|
+
13219200:EET:0:7200
|
134
|
+
18230400:EEST:1:10800
|
135
|
+
13219200:EET:0:7200
|
136
|
+
18230400:EEST:1:10800
|
137
|
+
13219200:EET:0:7200
|
138
|
+
18230400:EEST:1:10800
|
139
|
+
13219200:EET:0:7200
|
140
|
+
18835200:EEST:1:10800
|
141
|
+
12614400:EET:0:7200
|
142
|
+
18835200:EEST:1:10800
|
143
|
+
13219200:EET:0:7200
|
144
|
+
18230400:EEST:1:10800
|
145
|
+
13219200:EET:0:7200
|
146
|
+
18230400:EEST:1:10800
|
147
|
+
13219200:EET:0:7200
|
148
|
+
18230400:EEST:1:10800
|
149
|
+
13219200:EET:0:7200
|
150
|
+
18835200:EEST:1:10800
|
151
|
+
12614400:EET:0:7200
|
152
|
+
18835200:EEST:1:10800
|
153
153
|
1:EET:0:7200
|
data/data/Asia/Hong_Kong
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
-2056690801:LMT:0:27402
|
2
|
-
|
3
|
-
|
2
|
+
1155780000:HKT:0:28800
|
3
|
+
9331200:HKST:1:32400
|
4
4
|
7331400:HKT:0:30600
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
123039000:JST:0:32400
|
6
|
+
13302000:HKT:0:28800
|
7
|
+
19366200:HKST:1:32400
|
8
|
+
11491200:HKT:0:28800
|
9
|
+
19958400:HKST:1:32400
|
10
|
+
13305600:HKT:0:28800
|
11
|
+
15724800:HKST:1:32400
|
12
|
+
13305600:HKT:0:28800
|
13
|
+
18144000:HKST:1:32400
|
14
|
+
13305600:HKT:0:28800
|
15
|
+
18144000:HKST:1:32400
|
16
|
+
13305600:HKT:0:28800
|
17
|
+
18144000:HKST:1:32400
|
18
|
+
13910400:HKT:0:28800
|
19
|
+
18144000:HKST:1:32400
|
20
|
+
13305600:HKT:0:28800
|
21
21
|
18140400:HKST:1:32400
|
22
22
|
12099600:HKT:0:28800
|
23
23
|
19350000:HKST:1:32400
|
data/data/Brazil/East
CHANGED
@@ -89,43 +89,4 @@
|
|
89
89
|
10882800:-02:1:-7200
|
90
90
|
22381200:-03:0:-10800
|
91
91
|
9068400:-02:1:-7200
|
92
|
-
|
93
|
-
9068400:-02:1:-7200
|
94
|
-
22381200:-03:0:-10800
|
95
|
-
9673200:-02:1:-7200
|
96
|
-
22381200:-03:0:-10800
|
97
|
-
9068400:-02:1:-7200
|
98
|
-
22381200:-03:0:-10800
|
99
|
-
9673200:-02:1:-7200
|
100
|
-
21776400:-03:0:-10800
|
101
|
-
9068400:-02:1:-7200
|
102
|
-
22381200:-03:0:-10800
|
103
|
-
9068400:-02:1:-7200
|
104
|
-
22381200:-03:0:-10800
|
105
|
-
9673200:-02:1:-7200
|
106
|
-
21776400:-03:0:-10800
|
107
|
-
9673200:-02:1:-7200
|
108
|
-
22381200:-03:0:-10800
|
109
|
-
9068400:-02:1:-7200
|
110
|
-
22381200:-03:0:-10800
|
111
|
-
9068400:-02:1:-7200
|
112
|
-
22381200:-03:0:-10800
|
113
|
-
9068400:-02:1:-7200
|
114
|
-
22381200:-03:0:-10800
|
115
|
-
9068400:-02:1:-7200
|
116
|
-
22381200:-03:0:-10800
|
117
|
-
9068400:-02:1:-7200
|
118
|
-
22986000:-03:0:-10800
|
119
|
-
9068400:-02:1:-7200
|
120
|
-
22381200:-03:0:-10800
|
121
|
-
9673200:-02:1:-7200
|
122
|
-
21776400:-03:0:-10800
|
123
|
-
9068400:-02:1:-7200
|
124
|
-
22381200:-03:0:-10800
|
125
|
-
9068400:-02:1:-7200
|
126
|
-
22381200:-03:0:-10800
|
127
|
-
9673200:-02:1:-7200
|
128
|
-
21776400:-03:0:-10800
|
129
|
-
9673200:-02:1:-7200
|
130
|
-
22381200:-03:0:-10800
|
131
|
-
1:-02:1:-7200
|
92
|
+
1:-03:0:-10800
|
data/data/Europe/Rome
CHANGED
data/data/Europe/San_Marino
CHANGED
data/data/Europe/Vatican
CHANGED
data/data/Hongkong
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
-2056690801:LMT:0:27402
|
2
|
-
|
3
|
-
|
2
|
+
1155780000:HKT:0:28800
|
3
|
+
9331200:HKST:1:32400
|
4
4
|
7331400:HKT:0:30600
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
123039000:JST:0:32400
|
6
|
+
13302000:HKT:0:28800
|
7
|
+
19366200:HKST:1:32400
|
8
|
+
11491200:HKT:0:28800
|
9
|
+
19958400:HKST:1:32400
|
10
|
+
13305600:HKT:0:28800
|
11
|
+
15724800:HKST:1:32400
|
12
|
+
13305600:HKT:0:28800
|
13
|
+
18144000:HKST:1:32400
|
14
|
+
13305600:HKT:0:28800
|
15
|
+
18144000:HKST:1:32400
|
16
|
+
13305600:HKT:0:28800
|
17
|
+
18144000:HKST:1:32400
|
18
|
+
13910400:HKT:0:28800
|
19
|
+
18144000:HKST:1:32400
|
20
|
+
13305600:HKT:0:28800
|
21
21
|
18140400:HKST:1:32400
|
22
22
|
12099600:HKT:0:28800
|
23
23
|
19350000:HKST:1:32400
|
data/lib/timezone/loader.rb
CHANGED
@@ -8,12 +8,15 @@ module Timezone # rubocop:disable Style/Documentation
|
|
8
8
|
ZONE_FILE_PATH = File.expand_path(File.dirname(__FILE__) + '/../../data')
|
9
9
|
SOURCE_BIT = 0
|
10
10
|
|
11
|
+
@rules = {} # cache of loaded rules
|
12
|
+
|
11
13
|
class << self
|
12
14
|
def load(name)
|
13
|
-
|
15
|
+
@rules.fetch(name) do
|
16
|
+
raise ::Timezone::Error::InvalidZone unless valid?(name)
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
@rules[name] = parse_zone_data(get_zone_data(name))
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
22
|
def names
|
data/lib/timezone/version.rb
CHANGED
data/lib/timezone/zone.rb
CHANGED
@@ -179,10 +179,6 @@ module Timezone
|
|
179
179
|
|
180
180
|
private
|
181
181
|
|
182
|
-
def private_rules
|
183
|
-
@rules ||= Loader.load(name)
|
184
|
-
end
|
185
|
-
|
186
182
|
def sanitize(time)
|
187
183
|
time.to_time
|
188
184
|
end
|
@@ -200,11 +196,15 @@ module Timezone
|
|
200
196
|
|
201
197
|
def rule_for_local(local)
|
202
198
|
local = local.to_i
|
199
|
+
rules = Loader.load(name)
|
203
200
|
|
204
201
|
# For each rule, convert the local time into the UTC equivalent for
|
205
202
|
# that rule offset, and then check if the UTC time matches the rule.
|
206
|
-
index =
|
207
|
-
|
203
|
+
index =
|
204
|
+
binary_search(rules, local) do |t, r|
|
205
|
+
match?(t - r[OFFSET_BIT], r)
|
206
|
+
end
|
207
|
+
match = rules[index]
|
208
208
|
|
209
209
|
utc = local - match[OFFSET_BIT]
|
210
210
|
|
@@ -213,7 +213,7 @@ module Timezone
|
|
213
213
|
return RuleSet.new(:missing, [match]) if rule_for_utc(utc) != match
|
214
214
|
|
215
215
|
# If the match is the last rule, then return it.
|
216
|
-
return RuleSet.new(:single, [match]) if index ==
|
216
|
+
return RuleSet.new(:single, [match]) if index == rules.length - 1
|
217
217
|
|
218
218
|
# If the UTC equivalent time falls within the last hour(s) of the time
|
219
219
|
# change which were replayed during a fall-back in time, then return
|
@@ -234,10 +234,10 @@ module Timezone
|
|
234
234
|
last_hour =
|
235
235
|
match[SOURCE_BIT] -
|
236
236
|
match[OFFSET_BIT] +
|
237
|
-
|
237
|
+
rules[index + 1][OFFSET_BIT]
|
238
238
|
|
239
239
|
if utc > last_hour
|
240
|
-
RuleSet.new(:double,
|
240
|
+
RuleSet.new(:double, rules[index..(index + 1)])
|
241
241
|
else
|
242
242
|
RuleSet.new(:single, [match])
|
243
243
|
end
|
@@ -245,27 +245,28 @@ module Timezone
|
|
245
245
|
|
246
246
|
def rule_for_utc(time)
|
247
247
|
time = time.to_i
|
248
|
+
rules = Loader.load(name)
|
248
249
|
|
249
|
-
|
250
|
+
rules[binary_search(rules, time) { |t, r| match?(t, r) }]
|
250
251
|
end
|
251
252
|
|
252
253
|
# Find the first rule that matches using binary search.
|
253
|
-
def binary_search(time, from = 0, to = nil, &block)
|
254
|
-
to =
|
254
|
+
def binary_search(rules, time, from = 0, to = nil, &block)
|
255
|
+
to = rules.length - 1 if to.nil?
|
255
256
|
|
256
257
|
return from if from == to
|
257
258
|
|
258
259
|
mid = (from + to).div(2)
|
259
260
|
|
260
|
-
unless yield(time,
|
261
|
-
return binary_search(time, mid + 1, to, &block)
|
261
|
+
unless yield(time, rules[mid])
|
262
|
+
return binary_search(rules, time, mid + 1, to, &block)
|
262
263
|
end
|
263
264
|
|
264
265
|
return mid if mid.zero?
|
265
266
|
|
266
|
-
return mid unless yield(time,
|
267
|
+
return mid unless yield(time, rules[mid - 1])
|
267
268
|
|
268
|
-
binary_search(time, from, mid - 1, &block)
|
269
|
+
binary_search(rules, time, from, mid - 1, &block)
|
269
270
|
end
|
270
271
|
end
|
271
272
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timezone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pan Thomakos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -747,7 +747,7 @@ requirements: []
|
|
747
747
|
rubygems_version: 3.0.1
|
748
748
|
signing_key:
|
749
749
|
specification_version: 4
|
750
|
-
summary: timezone-1.3.
|
750
|
+
summary: timezone-1.3.5
|
751
751
|
test_files:
|
752
752
|
- test/data/Helsinki_rules_without_timestamps.json
|
753
753
|
- test/data/asia
|