tzinfo 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +56 -3
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/tzinfo/data_source.rb +11 -0
- data/lib/tzinfo/data_sources/posix_time_zone_parser.rb +2 -6
- data/lib/tzinfo/data_sources/ruby_data_source.rb +3 -7
- data/lib/tzinfo/data_sources/zoneinfo_data_source.rb +26 -14
- data/lib/tzinfo/data_sources/zoneinfo_reader.rb +1 -5
- data/lib/tzinfo/ruby_core_support.rb +38 -0
- data/lib/tzinfo/timestamp.rb +18 -14
- data/lib/tzinfo/version.rb +1 -1
- data/lib/tzinfo.rb +14 -6
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
- data/lib/tzinfo/untaint_ext.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15d9fc81161265595f6a97ed55898742c0b8f912052bffe58aca4528c08855c8
|
4
|
+
data.tar.gz: adf8f44066cfd018a145416f53b510615d8143bad62a3105dcabfb37c900a2e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a124cea3cb29e8e6227bc72527da598d4047801a32998a3cb427d3dae4bfdc241e070f95c0db556db504f773f470a3855b2e4579bded1b5e00e68c33f2733b
|
7
|
+
data.tar.gz: 6f00d941afda6034a23a125ec06a175c60c0c50e0c7cf9b8b1f2a7adad82b9bd768d2c46b3d44bf1b2f0dc8b690ccf410d979a9821d3959e370b2c93e41163b8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## Version 2.0.6 - 28-Jan-2023
|
4
|
+
|
5
|
+
* Eliminate `Object#untaint` deprecation warnings on JRuby 9.4.0.0. #145.
|
6
|
+
|
7
|
+
|
8
|
+
## Version 2.0.5 - 19-Jul-2022
|
9
|
+
|
10
|
+
* Changed `DateTime` results to always use the proleptic Gregorian calendar.
|
11
|
+
This affects `DateTime` results prior to 1582-10-15 and any arithmetic
|
12
|
+
performed on the results that would produce a secondary result prior to
|
13
|
+
1582-10-15.
|
14
|
+
* Added support for eager loading all the time zone and country data by calling
|
15
|
+
either `TZInfo::DataSource#eager_load!` or `TZInfo.eager_load!`. Compatible
|
16
|
+
with Ruby On Rails' `eager_load_namespaces`. #129.
|
17
|
+
* Ignore the SECURITY file from Arch Linux's tzdata package. #134.
|
18
|
+
|
19
|
+
|
3
20
|
## Version 2.0.4 - 16-Dec-2020
|
4
21
|
|
5
|
-
* Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a
|
22
|
+
* Fixed an incorrect `InvalidTimezoneIdentifier` exception raised when loading a
|
6
23
|
zoneinfo file that includes rules specifying an additional transition to the
|
7
24
|
final defined offset (for example, Africa/Casablanca in version 2018e of the
|
8
25
|
Time Zone Database). #123.
|
@@ -182,9 +199,23 @@
|
|
182
199
|
`TZInfo::Country.get('US').zone_identifiers` should be used instead.
|
183
200
|
|
184
201
|
|
202
|
+
## Version 1.2.11 - 28-Jan-2023
|
203
|
+
|
204
|
+
* Eliminate `Object#untaint` deprecation warnings on JRuby 9.4.0.0. #145.
|
205
|
+
|
206
|
+
|
207
|
+
## Version 1.2.10 - 19-Jul-2022
|
208
|
+
|
209
|
+
* Fixed a relative path traversal bug that could cause arbitrary files to be
|
210
|
+
loaded with `require` when used with `RubyDataSource`. Please refer to
|
211
|
+
<https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx> for
|
212
|
+
details. CVE-2022-31163.
|
213
|
+
* Ignore the SECURITY file from Arch Linux's tzdata package. #134.
|
214
|
+
|
215
|
+
|
185
216
|
## Version 1.2.9 - 16-Dec-2020
|
186
217
|
|
187
|
-
* Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a
|
218
|
+
* Fixed an incorrect `InvalidTimezoneIdentifier` exception raised when loading a
|
188
219
|
zoneinfo file that includes rules specifying an additional transition to the
|
189
220
|
final defined offset (for example, Africa/Casablanca in version 2018e of the
|
190
221
|
Time Zone Database). #123.
|
@@ -340,10 +371,32 @@
|
|
340
371
|
use other `TimezonePeriod` instance methods instead (issue #7655).
|
341
372
|
|
342
373
|
|
374
|
+
## Version 0.3.61 (tzdata v2022a) - 19-Jul-2022
|
375
|
+
|
376
|
+
* Fixed a relative path traversal bug that could cause arbitrary files to be
|
377
|
+
loaded with `require` from the Ruby load path. Please refer to
|
378
|
+
<https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx> for
|
379
|
+
details. CVE-2022-31163.
|
380
|
+
* Updated to tzdata version 2022a
|
381
|
+
(<https://mm.icann.org/pipermail/tz-announce/2022-March/000070.html>).
|
382
|
+
|
383
|
+
|
384
|
+
## Version 0.3.60 (tzdata v2021a) - 6-Feb-2021
|
385
|
+
|
386
|
+
* Updated to tzdata version 2021a
|
387
|
+
(<https://mm.icann.org/pipermail/tz-announce/2021-January/000065.html>).
|
388
|
+
|
389
|
+
|
390
|
+
## Version 0.3.59 (tzdata v2020e) - 24-Dec-2020
|
391
|
+
|
392
|
+
* Updated to tzdata version 2020e
|
393
|
+
(<https://mm.icann.org/pipermail/tz-announce/2020-December/000063.html>).
|
394
|
+
|
395
|
+
|
343
396
|
## Version 0.3.58 (tzdata v2020d) - 8-Nov-2020
|
344
397
|
|
345
398
|
* Updated to tzdata version 2020d
|
346
|
-
(https://mm.icann.org/pipermail/tz-announce/2020-October/000062.html).
|
399
|
+
(<https://mm.icann.org/pipermail/tz-announce/2020-October/000062.html>).
|
347
400
|
|
348
401
|
|
349
402
|
## 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
|
-
[](https://rubygems.org/gems/tzinfo) [](https://rubygems.org/gems/tzinfo) [](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"
|
@@ -4,10 +4,6 @@
|
|
4
4
|
require 'strscan'
|
5
5
|
|
6
6
|
module TZInfo
|
7
|
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
8
|
-
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
9
|
-
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
10
|
-
|
11
7
|
module DataSources
|
12
8
|
# An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style
|
13
9
|
# time zone string is encountered.
|
@@ -43,12 +39,12 @@ module TZInfo
|
|
43
39
|
|
44
40
|
s = StringScanner.new(tz_string)
|
45
41
|
check_scan(s, /([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
46
|
-
std_abbrev = @string_deduper.dedupe((s[1] || s[2])
|
42
|
+
std_abbrev = @string_deduper.dedupe(RubyCoreSupport.untaint(s[1] || s[2]))
|
47
43
|
check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
48
44
|
std_offset = get_offset_from_hms(s[1], s[2], s[3])
|
49
45
|
|
50
46
|
if s.scan(/([^-+,\d<][^-+,\d]*) | <([^>]+)>/x)
|
51
|
-
dst_abbrev = @string_deduper.dedupe((s[1] || s[2])
|
47
|
+
dst_abbrev = @string_deduper.dedupe(RubyCoreSupport.untaint(s[1] || s[2]))
|
52
48
|
|
53
49
|
if s.scan(/([-+]?\d+)(?::(\d+)(?::(\d+))?)?/)
|
54
50
|
dst_offset = get_offset_from_hms(s[1], s[2], s[3])
|
@@ -2,10 +2,6 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module TZInfo
|
5
|
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
6
|
-
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
7
|
-
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
8
|
-
|
9
5
|
module DataSources
|
10
6
|
# A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could
|
11
7
|
# not be found (i.e. `require 'tzinfo/data'` failed) when selecting the Ruby
|
@@ -52,7 +48,7 @@ module TZInfo
|
|
52
48
|
data_file = File.join('', 'tzinfo', 'data.rb')
|
53
49
|
path = $".reverse_each.detect {|p| p.end_with?(data_file) }
|
54
50
|
if path
|
55
|
-
@base_path = File.join(File.dirname(path), 'data')
|
51
|
+
@base_path = RubyCoreSupport.untaint(File.join(File.dirname(path), 'data'))
|
56
52
|
else
|
57
53
|
@base_path = 'tzinfo/data'
|
58
54
|
end
|
@@ -116,14 +112,14 @@ module TZInfo
|
|
116
112
|
# @param identifier [Array<string>] the component parts of a time zone
|
117
113
|
# identifier (split on /). This must have already been validated.
|
118
114
|
def require_definition(identifier)
|
119
|
-
require_data(
|
115
|
+
require_data('definitions', *identifier)
|
120
116
|
end
|
121
117
|
|
122
118
|
# Requires an index by its name.
|
123
119
|
#
|
124
120
|
# @param name [String] an index name.
|
125
121
|
def require_index(name)
|
126
|
-
require_data(
|
122
|
+
require_data('indexes', name)
|
127
123
|
end
|
128
124
|
|
129
125
|
# Requires a file from tzinfo/data.
|
@@ -2,10 +2,6 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module TZInfo
|
5
|
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
6
|
-
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
7
|
-
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
8
|
-
|
9
5
|
module DataSources
|
10
6
|
# An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource}
|
11
7
|
# is initialized with a specific zoneinfo path that is not a valid zoneinfo
|
@@ -78,6 +74,30 @@ module TZInfo
|
|
78
74
|
DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166'].freeze
|
79
75
|
private_constant :DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH
|
80
76
|
|
77
|
+
# Files and directories in the top level zoneinfo directory that will be
|
78
|
+
# excluded from the list of available time zones:
|
79
|
+
#
|
80
|
+
# - +VERSION is included on Mac OS X.
|
81
|
+
# - leapseconds is a list of leap seconds.
|
82
|
+
# - localtime is the current local timezone (may be a link).
|
83
|
+
# - posix, posixrules and right are directories containing other
|
84
|
+
# versions of the zoneinfo files.
|
85
|
+
# - SECURITY is included in the Arch Linux tzdata package.
|
86
|
+
# - src is a directory containing the tzdata source included on Solaris.
|
87
|
+
# - timeconfig is a symlink included on Slackware.
|
88
|
+
EXCLUDED_FILENAMES = [
|
89
|
+
'+VERSION',
|
90
|
+
'leapseconds',
|
91
|
+
'localtime',
|
92
|
+
'posix',
|
93
|
+
'posixrules',
|
94
|
+
'right',
|
95
|
+
'SECURITY',
|
96
|
+
'src',
|
97
|
+
'timeconfig'
|
98
|
+
].freeze
|
99
|
+
private_constant :EXCLUDED_FILENAMES
|
100
|
+
|
81
101
|
# Paths to be checked to find the system zoneinfo directory.
|
82
102
|
#
|
83
103
|
# @private
|
@@ -394,15 +414,7 @@ module TZInfo
|
|
394
414
|
def load_timezone_identifiers
|
395
415
|
index = []
|
396
416
|
|
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|
|
417
|
+
enum_timezones([], EXCLUDED_FILENAMES) do |identifier|
|
406
418
|
index << identifier.join('/').freeze
|
407
419
|
end
|
408
420
|
|
@@ -428,7 +440,7 @@ module TZInfo
|
|
428
440
|
end
|
429
441
|
|
430
442
|
unless entry =~ /\./ || exclude.include?(entry)
|
431
|
-
|
443
|
+
RubyCoreSupport.untaint(entry)
|
432
444
|
path = dir + [entry]
|
433
445
|
full_path = File.join(@zoneinfo_dir, *path)
|
434
446
|
|
@@ -2,10 +2,6 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module TZInfo
|
5
|
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors
|
6
|
-
# with JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
|
7
|
-
send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
|
8
|
-
|
9
5
|
module DataSources
|
10
6
|
# An {InvalidZoneinfoFile} exception is raised if an attempt is made to load
|
11
7
|
# an invalid zoneinfo file.
|
@@ -448,7 +444,7 @@ module TZInfo
|
|
448
444
|
abbrev_end = abbrev.index("\0", abbrev_start)
|
449
445
|
raise InvalidZoneinfoFile, "Missing abbreviation null terminator in file '#{file.path}'." unless abbrev_end
|
450
446
|
|
451
|
-
abbr = @string_deduper.dedupe(abbrev[abbrev_start...abbrev_end].force_encoding(Encoding::UTF_8)
|
447
|
+
abbr = @string_deduper.dedupe(RubyCoreSupport.untaint(abbrev[abbrev_start...abbrev_end].force_encoding(Encoding::UTF_8)))
|
452
448
|
|
453
449
|
TimezoneOffset.new(base_utc_offset, std_offset, abbr)
|
454
450
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module TZInfo
|
2
|
+
|
3
|
+
# Methods to support different versions of Ruby.
|
4
|
+
#
|
5
|
+
# @private
|
6
|
+
module RubyCoreSupport #:nodoc:
|
7
|
+
class << self
|
8
|
+
# Object#untaint is deprecated and becomes a no-op in Ruby >= 2.7. It has
|
9
|
+
# been removed from Ruby 3.2.
|
10
|
+
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
|
11
|
+
# :nocov_functional_untaint:
|
12
|
+
|
13
|
+
# Returns the supplied `Object`
|
14
|
+
#
|
15
|
+
# @param o [Object] the `Object` to untaint.
|
16
|
+
# @return [Object] `o`.
|
17
|
+
def untaint(o)
|
18
|
+
o
|
19
|
+
end
|
20
|
+
|
21
|
+
# :nocov_functional_untaint:
|
22
|
+
else
|
23
|
+
# :nocov_no_functional_untaint:
|
24
|
+
|
25
|
+
# Untaints and returns the supplied `Object`.
|
26
|
+
#
|
27
|
+
# @param o [Object] the `Object` to untaint.
|
28
|
+
# @return [Object] `o`.
|
29
|
+
def untaint(o)
|
30
|
+
o.untaint
|
31
|
+
end
|
32
|
+
|
33
|
+
# :nocov_no_functional_untaint:
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
private_constant :RubyCoreSupport
|
38
|
+
end
|
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,14 +3,22 @@
|
|
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
|
-
|
9
|
-
|
10
|
-
# needed.
|
11
|
-
if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3)
|
12
|
-
require_relative 'tzinfo/untaint_ext'
|
13
|
-
end
|
20
|
+
|
21
|
+
require_relative 'tzinfo/ruby_core_support'
|
14
22
|
|
15
23
|
require_relative 'tzinfo/version'
|
16
24
|
|
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.6
|
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: 2023-01-28 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: concurrent-ruby
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/tzinfo/info_timezone.rb
|
95
95
|
- lib/tzinfo/linked_timezone.rb
|
96
96
|
- lib/tzinfo/offset_timezone_period.rb
|
97
|
+
- lib/tzinfo/ruby_core_support.rb
|
97
98
|
- lib/tzinfo/string_deduper.rb
|
98
99
|
- lib/tzinfo/time_with_offset.rb
|
99
100
|
- lib/tzinfo/timestamp.rb
|
@@ -105,7 +106,6 @@ files:
|
|
105
106
|
- lib/tzinfo/timezone_transition.rb
|
106
107
|
- lib/tzinfo/transition_rule.rb
|
107
108
|
- lib/tzinfo/transitions_timezone_period.rb
|
108
|
-
- lib/tzinfo/untaint_ext.rb
|
109
109
|
- lib/tzinfo/version.rb
|
110
110
|
- lib/tzinfo/with_offset.rb
|
111
111
|
homepage: https://tzinfo.github.io
|
@@ -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.6
|
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.6
|
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.4.5
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Time Zone Library
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/tzinfo/untaint_ext.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module TZInfo
|
5
|
-
# Object#untaint is deprecated in Ruby >= 2.7 and will be removed in 3.2.
|
6
|
-
# UntaintExt adds a refinement to make Object#untaint a no-op and avoid the
|
7
|
-
# warning.
|
8
|
-
#
|
9
|
-
# @private
|
10
|
-
module UntaintExt # :nodoc:
|
11
|
-
refine Object do
|
12
|
-
def untaint
|
13
|
-
self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
private_constant :UntaintExt
|
18
|
-
end
|