tzinfo 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +46 -3
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/tzinfo/data_source.rb +11 -0
- data/lib/tzinfo/data_sources/ruby_data_source.rb +2 -2
- data/lib/tzinfo/data_sources/zoneinfo_data_source.rb +25 -9
- data/lib/tzinfo/timestamp.rb +18 -14
- data/lib/tzinfo/version.rb +1 -1
- data/lib/tzinfo.rb +12 -0
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5b3120678f9251533f0c044814f666142eb5538412c92c06aa66719251f474
|
4
|
+
data.tar.gz: a837074505ff48d553506e1eeb4eac8e3148cc6aa48e996e552d4d9bde1ef614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f43bcf636bc1c3311cc3d417a951dfeb7cc697ad37add1b6b4bbbb0caa0a7226da508ca5c5521d1cf122254ded7ecd4b1da7f6240121dc311b1706c15119d1
|
7
|
+
data.tar.gz: 48314ac805148665c326cc450e2dc96582bb26a2ecc58d97234252c866a162f4f60d2495b6ddaaf3f7b3bd27190d9db452159d58ae57505463a836ce097b5acc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## Version 2.0.5 - 19-Jul-2022
|
4
|
+
|
5
|
+
* Changed `DateTime` results to always use the proleptic Gregorian calendar.
|
6
|
+
This affects `DateTime` results prior to 1582-10-15 and any arithmetic
|
7
|
+
performed on the results that would produce a secondary result prior to
|
8
|
+
1582-10-15.
|
9
|
+
* Added support for eager loading all the time zone and country data by calling
|
10
|
+
either `TZInfo::DataSource#eager_load!` or `TZInfo.eager_load!`. Compatible
|
11
|
+
with Ruby On Rails' `eager_load_namespaces`. #129.
|
12
|
+
* Ignore the SECURITY file from Arch Linux's tzdata package. #134.
|
13
|
+
|
14
|
+
|
3
15
|
## Version 2.0.4 - 16-Dec-2020
|
4
16
|
|
5
|
-
* Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a
|
17
|
+
* Fixed an incorrect `InvalidTimezoneIdentifier` exception raised when loading a
|
6
18
|
zoneinfo file that includes rules specifying an additional transition to the
|
7
19
|
final defined offset (for example, Africa/Casablanca in version 2018e of the
|
8
20
|
Time Zone Database). #123.
|
@@ -182,9 +194,18 @@
|
|
182
194
|
`TZInfo::Country.get('US').zone_identifiers` should be used instead.
|
183
195
|
|
184
196
|
|
197
|
+
## Version 1.2.10 - 19-Jul-2022
|
198
|
+
|
199
|
+
* Fixed a relative path traversal bug that could cause arbitrary files to be
|
200
|
+
loaded with `require` when used with `RubyDataSource`. Please refer to
|
201
|
+
<https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx> for
|
202
|
+
details. CVE-2022-31163.
|
203
|
+
* Ignore the SECURITY file from Arch Linux's tzdata package. #134.
|
204
|
+
|
205
|
+
|
185
206
|
## Version 1.2.9 - 16-Dec-2020
|
186
207
|
|
187
|
-
* Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a
|
208
|
+
* Fixed an incorrect `InvalidTimezoneIdentifier` exception raised when loading a
|
188
209
|
zoneinfo file that includes rules specifying an additional transition to the
|
189
210
|
final defined offset (for example, Africa/Casablanca in version 2018e of the
|
190
211
|
Time Zone Database). #123.
|
@@ -340,10 +361,32 @@
|
|
340
361
|
use other `TimezonePeriod` instance methods instead (issue #7655).
|
341
362
|
|
342
363
|
|
364
|
+
## Version 0.3.61 (tzdata v2022a) - 19-Jul-2022
|
365
|
+
|
366
|
+
* Fixed a relative path traversal bug that could cause arbitrary files to be
|
367
|
+
loaded with `require` from the Ruby load path. Please refer to
|
368
|
+
<https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx> for
|
369
|
+
details. CVE-2022-31163.
|
370
|
+
* Updated to tzdata version 2022a
|
371
|
+
(<https://mm.icann.org/pipermail/tz-announce/2022-March/000070.html>).
|
372
|
+
|
373
|
+
|
374
|
+
## Version 0.3.60 (tzdata v2021a) - 6-Feb-2021
|
375
|
+
|
376
|
+
* Updated to tzdata version 2021a
|
377
|
+
(<https://mm.icann.org/pipermail/tz-announce/2021-January/000065.html>).
|
378
|
+
|
379
|
+
|
380
|
+
## Version 0.3.59 (tzdata v2020e) - 24-Dec-2020
|
381
|
+
|
382
|
+
* Updated to tzdata version 2020e
|
383
|
+
(<https://mm.icann.org/pipermail/tz-announce/2020-December/000063.html>).
|
384
|
+
|
385
|
+
|
343
386
|
## Version 0.3.58 (tzdata v2020d) - 8-Nov-2020
|
344
387
|
|
345
388
|
* Updated to tzdata version 2020d
|
346
|
-
(https://mm.icann.org/pipermail/tz-announce/2020-October/000062.html).
|
389
|
+
(<https://mm.icann.org/pipermail/tz-announce/2020-October/000062.html>).
|
347
390
|
|
348
391
|
|
349
392
|
## Version 0.3.57 (tzdata v2020a) - 17-May-2020
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# TZInfo - Ruby Time Zone Library
|
2
2
|
|
3
|
-
[![RubyGems](https://img.shields.io/gem/v/tzinfo)](https://rubygems.org/gems/tzinfo) [![
|
3
|
+
[![RubyGems](https://img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem)](https://rubygems.org/gems/tzinfo) [![Tests](https://github.com/tzinfo/tzinfo/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/tzinfo/tzinfo/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush)
|
4
4
|
|
5
5
|
[TZInfo](https://tzinfo.github.io) is a Ruby library that provides access to
|
6
6
|
time zone data and allows times to be converted using time zone rules.
|
@@ -36,7 +36,7 @@ documentation for further details.
|
|
36
36
|
## Installation
|
37
37
|
|
38
38
|
The TZInfo gem can be installed by running `gem install tzinfo` or by adding
|
39
|
-
|
39
|
+
`gem 'tzinfo'` to your `Gemfile` and running `bundle install`.
|
40
40
|
|
41
41
|
To use the Ruby modules as the data source, TZInfo::Data will also need to be
|
42
42
|
installed by running `gem install tzinfo-data` or by adding `gem 'tzinfo-data'`
|
data/lib/tzinfo/data_source.rb
CHANGED
@@ -247,6 +247,17 @@ module TZInfo
|
|
247
247
|
raise_invalid_data_source('country_codes')
|
248
248
|
end
|
249
249
|
|
250
|
+
# Loads all timezone and country data into memory.
|
251
|
+
#
|
252
|
+
# This may be desirable in production environments to improve copy-on-write
|
253
|
+
# performance and to avoid flushing the constant cache every time a new
|
254
|
+
# timezone or country is loaded from {DataSources::RubyDataSource}.
|
255
|
+
def eager_load!
|
256
|
+
timezone_identifiers.each {|identifier| load_timezone_info(identifier) }
|
257
|
+
country_codes.each {|code| load_country_info(code) }
|
258
|
+
nil
|
259
|
+
end
|
260
|
+
|
250
261
|
# @return [String] a description of the {DataSource}.
|
251
262
|
def to_s
|
252
263
|
"Default DataSource"
|
@@ -116,14 +116,14 @@ module TZInfo
|
|
116
116
|
# @param identifier [Array<string>] the component parts of a time zone
|
117
117
|
# identifier (split on /). This must have already been validated.
|
118
118
|
def require_definition(identifier)
|
119
|
-
require_data(
|
119
|
+
require_data('definitions', *identifier)
|
120
120
|
end
|
121
121
|
|
122
122
|
# Requires an index by its name.
|
123
123
|
#
|
124
124
|
# @param name [String] an index name.
|
125
125
|
def require_index(name)
|
126
|
-
require_data(
|
126
|
+
require_data('indexes', name)
|
127
127
|
end
|
128
128
|
|
129
129
|
# Requires a file from tzinfo/data.
|
@@ -78,6 +78,30 @@ module TZInfo
|
|
78
78
|
DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166'].freeze
|
79
79
|
private_constant :DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH
|
80
80
|
|
81
|
+
# Files and directories in the top level zoneinfo directory that will be
|
82
|
+
# excluded from the list of available time zones:
|
83
|
+
#
|
84
|
+
# - +VERSION is included on Mac OS X.
|
85
|
+
# - leapseconds is a list of leap seconds.
|
86
|
+
# - localtime is the current local timezone (may be a link).
|
87
|
+
# - posix, posixrules and right are directories containing other
|
88
|
+
# versions of the zoneinfo files.
|
89
|
+
# - SECURITY is included in the Arch Linux tzdata package.
|
90
|
+
# - src is a directory containing the tzdata source included on Solaris.
|
91
|
+
# - timeconfig is a symlink included on Slackware.
|
92
|
+
EXCLUDED_FILENAMES = [
|
93
|
+
'+VERSION',
|
94
|
+
'leapseconds',
|
95
|
+
'localtime',
|
96
|
+
'posix',
|
97
|
+
'posixrules',
|
98
|
+
'right',
|
99
|
+
'SECURITY',
|
100
|
+
'src',
|
101
|
+
'timeconfig'
|
102
|
+
].freeze
|
103
|
+
private_constant :EXCLUDED_FILENAMES
|
104
|
+
|
81
105
|
# Paths to be checked to find the system zoneinfo directory.
|
82
106
|
#
|
83
107
|
# @private
|
@@ -394,15 +418,7 @@ module TZInfo
|
|
394
418
|
def load_timezone_identifiers
|
395
419
|
index = []
|
396
420
|
|
397
|
-
|
398
|
-
# +VERSION is included on Mac OS X.
|
399
|
-
# leapseconds is a list of leap seconds.
|
400
|
-
# localtime is the current local timezone (may be a link).
|
401
|
-
# posix, posixrules and right are directories containing other versions of the zoneinfo files.
|
402
|
-
# src is a directory containing the tzdata source included on Solaris.
|
403
|
-
# timeconfig is a symlink included on Slackware.
|
404
|
-
|
405
|
-
enum_timezones([], ['+VERSION', 'leapseconds', 'localtime', 'posix', 'posixrules', 'right', 'src', 'timeconfig']) do |identifier|
|
421
|
+
enum_timezones([], EXCLUDED_FILENAMES) do |identifier|
|
406
422
|
index << identifier.join('/').freeze
|
407
423
|
end
|
408
424
|
|
data/lib/tzinfo/timestamp.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
module TZInfo
|
5
5
|
# A time represented as an `Integer` number of seconds since 1970-01-01
|
6
|
-
# 00:00:00 UTC (ignoring leap seconds
|
7
|
-
# (sub_second as a `Rational`) and
|
8
|
-
#
|
9
|
-
#
|
6
|
+
# 00:00:00 UTC (ignoring leap seconds and using the proleptic Gregorian
|
7
|
+
# calendar), the fraction through the second (sub_second as a `Rational`) and
|
8
|
+
# an optional UTC offset. Like Ruby's `Time` class, {Timestamp} can
|
9
|
+
# distinguish between a local time with a zero offset and a time specified
|
10
|
+
# explicitly as UTC.
|
10
11
|
class Timestamp
|
11
12
|
include Comparable
|
12
13
|
|
@@ -16,8 +17,8 @@ module TZInfo
|
|
16
17
|
private_constant :JD_EPOCH
|
17
18
|
|
18
19
|
class << self
|
19
|
-
# Returns a new {Timestamp} representing the (Gregorian
|
20
|
-
# time specified by the supplied parameters.
|
20
|
+
# Returns a new {Timestamp} representing the (proleptic Gregorian
|
21
|
+
# calendar) date and time specified by the supplied parameters.
|
21
22
|
#
|
22
23
|
# If `utc_offset` is `nil`, `:utc` or 0, the date and time parameters will
|
23
24
|
# be interpreted as representing a UTC date and time. Otherwise the date
|
@@ -37,7 +38,7 @@ module TZInfo
|
|
37
38
|
# specified offset, an offset from UTC specified as an `Integer` number
|
38
39
|
# of seconds or the `Symbol` `:utc`).
|
39
40
|
# @return [Timestamp] a new {Timestamp} representing the specified
|
40
|
-
# (Gregorian calendar) date and time.
|
41
|
+
# (proleptic Gregorian calendar) date and time.
|
41
42
|
# @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`,
|
42
43
|
# `minute`, or `second` is not an `Integer`.
|
43
44
|
# @raise [ArgumentError] if `sub_second` is not a `Rational`, or the
|
@@ -84,7 +85,8 @@ module TZInfo
|
|
84
85
|
# When called with a block, the {Timestamp} representation of `value` is
|
85
86
|
# passed to the block. The block must then return a {Timestamp}, which
|
86
87
|
# will be converted back to the type of the initial value. If the initial
|
87
|
-
# value was a {Timestamp}, the block result will
|
88
|
+
# value was a {Timestamp}, the block result will be returned. If the
|
89
|
+
# initial value was a `DateTime`, a Gregorian `DateTime` will be returned.
|
88
90
|
#
|
89
91
|
# The UTC offset of `value` can either be preserved (the {Timestamp}
|
90
92
|
# representation will have the same UTC offset as `value`), ignored (the
|
@@ -396,11 +398,11 @@ module TZInfo
|
|
396
398
|
end
|
397
399
|
end
|
398
400
|
|
399
|
-
# Converts this {Timestamp} to a `DateTime`.
|
401
|
+
# Converts this {Timestamp} to a Gregorian `DateTime`.
|
400
402
|
#
|
401
|
-
# @return [DateTime] a DateTime representation of this
|
402
|
-
# UTC offset of this {Timestamp} is not specified, a
|
403
|
-
# be returned.
|
403
|
+
# @return [DateTime] a Gregorian `DateTime` representation of this
|
404
|
+
# {Timestamp}. If the UTC offset of this {Timestamp} is not specified, a
|
405
|
+
# UTC `DateTime` will be returned.
|
404
406
|
def to_datetime
|
405
407
|
new_datetime
|
406
408
|
end
|
@@ -408,7 +410,7 @@ module TZInfo
|
|
408
410
|
# Converts this {Timestamp} to an `Integer` number of seconds since
|
409
411
|
# 1970-01-01 00:00:00 UTC (ignoring leap seconds).
|
410
412
|
#
|
411
|
-
# @return [Integer] an Integer representation of this {Timestamp} (the
|
413
|
+
# @return [Integer] an `Integer` representation of this {Timestamp} (the
|
412
414
|
# number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds).
|
413
415
|
def to_i
|
414
416
|
value
|
@@ -492,7 +494,9 @@ module TZInfo
|
|
492
494
|
#
|
493
495
|
# @private
|
494
496
|
def new_datetime(klass = DateTime)
|
495
|
-
|
497
|
+
# Can't specify the start parameter unless the jd parameter is an exact number of days.
|
498
|
+
# Use #gregorian instead.
|
499
|
+
datetime = klass.jd(JD_EPOCH + ((@value.to_r + @sub_second) / 86400)).gregorian
|
496
500
|
@utc_offset && @utc_offset != 0 ? datetime.new_offset(Rational(@utc_offset, 86400)) : datetime
|
497
501
|
end
|
498
502
|
|
data/lib/tzinfo/version.rb
CHANGED
data/lib/tzinfo.rb
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
|
4
4
|
# The top level module for TZInfo.
|
5
5
|
module TZInfo
|
6
|
+
class << self
|
7
|
+
# Instructs the current {DataSource} to load all timezone and country data
|
8
|
+
# into memory (initializing the {DataSource} first if not previously
|
9
|
+
# accessed or set).
|
10
|
+
#
|
11
|
+
# This may be desirable in production environments to improve copy-on-write
|
12
|
+
# performance and to avoid flushing the constant cache every time a new
|
13
|
+
# timezone or country is loaded from {DataSources::RubyDataSource}.
|
14
|
+
def eager_load!
|
15
|
+
DataSource.get.eager_load!
|
16
|
+
end
|
17
|
+
end
|
6
18
|
end
|
7
19
|
|
8
20
|
# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tzinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Ross
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
J3Zn/kSTjTekiaspyGbczC3PUaeJNxr+yCvR4sk71Xmk/GaKKGOHedJ1uj/LAXrA
|
30
30
|
MR0mpl7b8zCg0PFC1J73uw==
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: concurrent-ruby
|
@@ -114,9 +114,9 @@ licenses:
|
|
114
114
|
metadata:
|
115
115
|
bug_tracker_uri: https://github.com/tzinfo/tzinfo/issues
|
116
116
|
changelog_uri: https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md
|
117
|
-
documentation_uri: https://rubydoc.info/gems/tzinfo/2.0.
|
117
|
+
documentation_uri: https://rubydoc.info/gems/tzinfo/2.0.5
|
118
118
|
homepage_uri: https://tzinfo.github.io
|
119
|
-
source_code_uri: https://github.com/tzinfo/tzinfo/tree/v2.0.
|
119
|
+
source_code_uri: https://github.com/tzinfo/tzinfo/tree/v2.0.5
|
120
120
|
post_install_message:
|
121
121
|
rdoc_options:
|
122
122
|
- "--title"
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.3.7
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Time Zone Library
|
metadata.gz.sig
CHANGED
Binary file
|