time-zone 1.1.1 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52752447d16bc54a681fd7b9c52044ec510beddbf3315f652220626d9061bda7
4
- data.tar.gz: 2a5ff164080ab6b044a9c3d802d9fd6c7eba5c69dfda7ce08893b86bb95bde1b
3
+ metadata.gz: 3cf6bc5cc4a6368caaf67d7ed914f486b36476604fcfd60b9724c0ba94f7d0da
4
+ data.tar.gz: 237845896fd9225288162f8997764a55d4e9a5e2e52590d216a7c8c5c8aff09e
5
5
  SHA512:
6
- metadata.gz: ed6bbebdf2ac66fbfec90825c05a0865d9d76db96fa2087d060af28eefadf5154e09a3c9e85b674e23921606bac3562a1283908ccfdf6d5bf49570e0a6fee0c5
7
- data.tar.gz: c1766ccf1db79f3a540af53b679dc2f1e9f53c590649cc03035a91276abaf81f0087cc5d627ba486ea9e21541d9cdaaf05880f28c634896dac733d2ed28cf423
6
+ metadata.gz: 3787903d9097e9d17577db819af7cde6cf5785f4b3c27f7bd0e448991bc0e0827ec34152ed9fc4c600565bf65a1d586f7fc517e7ae36d84d5b8b519841b116e4
7
+ data.tar.gz: 3ed87cfdeac630a3b24a2f6c3915a8b21036d4c6e0868ee753adb9ade5f6d7cddab7c970caa40469eb988c2c79e480e3d44af106a672cd7954319ff9373f6fd9
@@ -25,6 +25,8 @@ require 'date'
25
25
  class Time
26
26
  module Zone
27
27
  class Timestamp
28
+ include Comparable
29
+
28
30
  def self.load(string)
29
31
  self.parse(string)
30
32
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  class Time
22
22
  module Zone
23
- VERSION = "1.1.1"
23
+ VERSION = "1.2.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time-zone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-30 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: bake-bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  description:
56
56
  email:
57
57
  - samuel.williams@oriontransfer.co.nz
@@ -59,18 +59,10 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
63
- - ".rspec"
64
- - ".travis.yml"
65
- - Gemfile
66
- - README.md
67
- - Rakefile
68
- - bug14879.rb
69
62
  - lib/time/zone.rb
70
63
  - lib/time/zone/locking.rb
71
64
  - lib/time/zone/timestamp.rb
72
65
  - lib/time/zone/version.rb
73
- - time-zone.gemspec
74
66
  homepage: https://github.com/ioquatix/time-zone
75
67
  licenses: []
76
68
  metadata: {}
@@ -89,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
81
  - !ruby/object:Gem::Version
90
82
  version: '0'
91
83
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.7.6
84
+ rubygems_version: 3.1.2
94
85
  signing_key:
95
86
  specification_version: 4
96
- summary: Use the system `date` command to compute time zones.
87
+ summary: Computes timezones using the system TZ environment variable.
97
88
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,28 +0,0 @@
1
- # Setup the environment:
2
- language: ruby
3
- dist: xenial
4
- cache: bundler
5
-
6
- before_script:
7
- - gem update --system
8
- - gem install bundler
9
-
10
- rvm:
11
- - 2.1
12
- - 2.2
13
- - 2.3
14
- - 2.4
15
- - 2.5
16
- - 2.6
17
- - jruby-head
18
- - ruby-head
19
-
20
- env:
21
- - TZ=UTC
22
- - TZ=Pacific/Auckland
23
-
24
- # Setup the compilers:
25
- matrix:
26
- allow_failures:
27
- - rvm: ruby-head
28
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,15 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in time-zone.gemspec
6
- gemspec
7
-
8
- group :development do
9
- gem 'pry'
10
- end
11
-
12
- group :test do
13
- gem 'simplecov'
14
- gem 'coveralls', require: false
15
- end
data/README.md DELETED
@@ -1,96 +0,0 @@
1
- # Time::Zone
2
-
3
- A very simple time-zone library which works by manipulating the `TZ` environment variable.
4
-
5
- [![Build Status](https://secure.travis-ci.org/ioquatix/time-zone.svg)](http://travis-ci.org/ioquatix/time-zone)
6
- [![Code Climate](https://codeclimate.com/github/ioquatix/time-zone.svg)](https://codeclimate.com/github/ioquatix/time-zone)
7
- [![Coverage Status](https://coveralls.io/repos/ioquatix/time-zone/badge.svg)](https://coveralls.io/r/ioquatix/time-zone)
8
-
9
- ## Motivation
10
-
11
- `tzinfo` has an antiquated view of `Time`. It returns local time values with a UTC time zone which is pretty much wrong.
12
-
13
- [![A brief history of Time.new](https://img.youtube.com/vi/UjdtH5gO_DQ/0.jpg)](https://www.youtube.com/watch?v=UjdtH5gO_DQ)
14
-
15
- ## Installation
16
-
17
- Add this line to your application's Gemfile:
18
-
19
- ```ruby
20
- gem 'time-zone'
21
- ```
22
-
23
- And then execute:
24
-
25
- $ bundle
26
-
27
- Or install it yourself as:
28
-
29
- $ gem install time-zone
30
-
31
- ## Usage
32
-
33
- There are two basic use cases, getting the current time, and converting times.
34
-
35
- ### Current Time
36
-
37
- ```ruby
38
- Time::Zone.now("Pacific/Auckland")
39
- => 2018-05-25 14:09:40 +1200
40
- ```
41
-
42
- ### Convert Time
43
-
44
- ```ruby
45
- Time::Zone.convert(Time.now.utc, "Pacific/Auckland")
46
- => 2018-05-25 14:14:22 +1200
47
- ```
48
-
49
- ### Multiple Operations
50
-
51
- ```ruby
52
- Time::Zone.with("US/Pacific") do
53
- # Be aware that in some cases Time values are lazy initialized, so you need to use #localtime to force them to evaluate and use the current `TZ`.
54
- time = Time.new.localtime
55
- puts time.inspect
56
- # => 2018-05-24 20:32:29 -0700
57
- end
58
- ```
59
-
60
- ### Caveats
61
-
62
- This implementation manipulates the per-process `TZ` environment variable. This means that if you don't put locking around all your usage of `localtime`, you may end up with strange results (i.e. in a timezone other than the system specified `TZ`). In the future, this requirement may go away.
63
-
64
- This library is unlikely to work on Windows because it doesn't correctly handle changes to `TZ`.
65
-
66
- ## Contributing
67
-
68
- 1. Fork it
69
- 2. Create your feature branch (`git checkout -b my-new-feature`)
70
- 3. Commit your changes (`git commit -am 'Add some feature'`)
71
- 4. Push to the branch (`git push origin my-new-feature`)
72
- 5. Create new Pull Request
73
-
74
- ## License
75
-
76
- Released under the MIT license.
77
-
78
- Copyright, 2012, 2014, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
79
-
80
- Permission is hereby granted, free of charge, to any person obtaining a copy
81
- of this software and associated documentation files (the "Software"), to deal
82
- in the Software without restriction, including without limitation the rights
83
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
84
- copies of the Software, and to permit persons to whom the Software is
85
- furnished to do so, subject to the following conditions:
86
-
87
- The above copyright notice and this permission notice shall be included in
88
- all copies or substantial portions of the Software.
89
-
90
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
91
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
92
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
93
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
94
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
95
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
96
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
7
-
8
- task :console do
9
- require 'pry'
10
- require_relative 'lib/time/zone'
11
- require_relative 'lib/time/zone/timestamp'
12
-
13
- Pry.start
14
- end
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # https://bugs.ruby-lang.org/issues/14879
4
- require 'time'
5
-
6
- ENV['TZ'] = "Pacific/Auckland"
7
- time = Time.parse("5pm")
8
- ENV['TZ'] = "UTC"
9
-
10
- puts time
11
- puts time.utc_offset
12
- puts (time + 1).utc_offset
13
- puts time + 1
@@ -1,22 +0,0 @@
1
-
2
- require_relative "lib/time/zone/version"
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "time-zone"
6
- spec.version = Time::Zone::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = "Use the system `date` command to compute time zones."
11
- spec.homepage = "https://github.com/ioquatix/time-zone"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_development_dependency "bundler", "~> 1.16"
20
- spec.add_development_dependency "rake", "~> 10.0"
21
- spec.add_development_dependency "rspec", "~> 3.0"
22
- end