mk_time 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/Guardfile +42 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/mk_time +20 -0
- data/lib/mk_time.rb +15 -0
- data/lib/mk_time/argument.rb +24 -0
- data/lib/mk_time/calc.rb +25 -0
- data/lib/mk_time/compute.rb +524 -0
- data/lib/mk_time/consts.rb +179 -0
- data/lib/mk_time/version.rb +3 -0
- data/mk_time.gemspec +33 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 061938b212f49cb24231b13987da223ddc6abf41
|
4
|
+
data.tar.gz: 957e47cc7988230237b9ab31192e26f7e7d78e8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10b62a77ebb9991e75d82811e50d75e74115164fe9a0cca570da9a504df475efd9008a0856f8b9dc52db80510f83c6fd41c23ffa33b690c1d67d676681f7c301
|
7
|
+
data.tar.gz: 2e97a1543253eb803a0e393e1720e3b294678ba6b71a6a66966e41fd000794df937ef80aea194bff5b83ebc9b0f72809ebba7c47c81fe70e3a3fe48c907fb4a3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Masaru Koizumi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# MkTime
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
This is a gem library which converts from UTC time to another time system.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'mk_time'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install mk_time
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Instantiation
|
26
|
+
|
27
|
+
t = MkTime.new("20160726")
|
28
|
+
t = MkTime.new("20160726123456")
|
29
|
+
e = MkTime.new
|
30
|
+
|
31
|
+
* You can set TDB formatted "YYYYMMDD" or "YYYYMMDDHHMMSS" as an argument.
|
32
|
+
* If you don't set an argument, this class considers the system time to have been set as an argument.
|
33
|
+
|
34
|
+
### Conversion
|
35
|
+
|
36
|
+
puts " UTC: #{t.utc}"
|
37
|
+
puts " JST: #{t.jst}"
|
38
|
+
puts " JD: #{t.jd} day"
|
39
|
+
puts " T: #{t.t} century"
|
40
|
+
puts " UTC-TAI: #{t.utc_tai} sec"
|
41
|
+
puts "LEAP_SEC: #{t.leap_sec} sec" # = tuc_tai
|
42
|
+
puts " DUT1: #{t.dut1} sec"
|
43
|
+
puts " deltaT: #{t.dt} sec"
|
44
|
+
puts " TAI: #{t.tai.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
45
|
+
puts " UT1: #{t.ut1.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
46
|
+
puts " TT: #{t.tt .instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
47
|
+
puts " TCG: #{t.tcg.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
48
|
+
puts " TCB: #{t.tcb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
49
|
+
puts " TDB: #{t.tdb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
50
|
+
|
51
|
+
* To check times under 1 second, I use `instance_eval` method.
|
52
|
+
|
53
|
+
## Development
|
54
|
+
|
55
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
56
|
+
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/komasaru/mk_time.
|
62
|
+
|
63
|
+
|
64
|
+
## License
|
65
|
+
|
66
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
67
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mk_time"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/mk_time
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "mk_time"
|
4
|
+
|
5
|
+
t = MkTime.new(ARGV[0])
|
6
|
+
puts " UTC: #{t.utc}"
|
7
|
+
puts " JST: #{t.jst}"
|
8
|
+
puts " JD: #{t.jd} day"
|
9
|
+
puts " T: #{t.t} century"
|
10
|
+
puts " UTC-TAI: #{t.utc_tai} sec"
|
11
|
+
puts "LEAP_SEC: #{t.leap_sec} sec" # = tuc_tai
|
12
|
+
puts " DUT1: #{t.dut1} sec"
|
13
|
+
puts " deltaT: #{t.dt} sec"
|
14
|
+
puts " TAI: #{t.tai.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
15
|
+
puts " UT1: #{t.ut1.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
16
|
+
puts " TT: #{t.tt .instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
17
|
+
puts " TCG: #{t.tcg.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
18
|
+
puts " TCB: #{t.tcb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
19
|
+
puts " TDB: #{t.tdb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
20
|
+
|
data/lib/mk_time.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "date"
|
2
|
+
require "mk_time/version"
|
3
|
+
require "mk_time/consts"
|
4
|
+
require "mk_time/argument"
|
5
|
+
require "mk_time/compute"
|
6
|
+
require "mk_time/calc"
|
7
|
+
|
8
|
+
module MkTime
|
9
|
+
def self.new(arg)
|
10
|
+
arg ||= Time.now.strftime("%Y%m%d%H%M%S")
|
11
|
+
utc = MkTime::Argument.new(arg).get_utc
|
12
|
+
return unless utc
|
13
|
+
return MkTime::Calc.new(utc)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module MkTime
|
2
|
+
class Argument
|
3
|
+
def initialize(arg)
|
4
|
+
@arg = arg
|
5
|
+
end
|
6
|
+
|
7
|
+
#=========================================================================
|
8
|
+
# 引数取得
|
9
|
+
#
|
10
|
+
# * コマンドライン引数を取得して日時の妥当性チェックを行う
|
11
|
+
# * コマンドライン引数無指定なら、現在日時とする。
|
12
|
+
#
|
13
|
+
# @return: utc (Time Object)
|
14
|
+
#=========================================================================
|
15
|
+
def get_utc
|
16
|
+
(puts Const::MSG_ERR_1; return) unless @arg =~ /^\d{8}$|^\d{14}$/
|
17
|
+
year, month, day = @arg[ 0, 4].to_i, @arg[ 4, 2].to_i, @arg[ 6, 2].to_i
|
18
|
+
hour, min, sec = @arg[ 8, 2].to_i, @arg[10, 2].to_i, @arg[12, 2].to_i
|
19
|
+
(puts Const::MSG_ERR_2; return) unless Date.valid_date?(year, month, day)
|
20
|
+
(puts Const::MSG_ERR_2; return) if hour > 23 || min > 59 || sec > 59
|
21
|
+
return Time.new(year, month, day, hour, min, sec, "+00:00")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/mk_time/calc.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module MkTime
|
2
|
+
class Calc
|
3
|
+
attr_reader :utc, :jst, :jd, :t, :utc_tai, :leap_sec, :dut1,
|
4
|
+
:ut1, :tai, :dt, :tt, :tcg, :tcb, :tdb
|
5
|
+
include Compute
|
6
|
+
alias leap_sec utc_tai
|
7
|
+
|
8
|
+
def initialize(arg)
|
9
|
+
@utc = arg
|
10
|
+
@jst = utc2jst(@utc)
|
11
|
+
@jd = gc2jd(@utc)
|
12
|
+
@t = jd2t(@jd)
|
13
|
+
@utc_tai = get_utc_tai(@utc)
|
14
|
+
@dut1 = get_dut1(@utc)
|
15
|
+
@ut1 = utc2ut1(@utc)
|
16
|
+
@tai = utc2tai(@utc)
|
17
|
+
@dt = calc_dt(@utc)
|
18
|
+
@tt = tai2tt(@tai)
|
19
|
+
@tcg = tt2tcg(@tt)
|
20
|
+
@tcb = tt2tcb(@tt)
|
21
|
+
@tdb = tcb2tdb(@tcb)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,524 @@
|
|
1
|
+
module MkTime
|
2
|
+
module Compute
|
3
|
+
module_function
|
4
|
+
|
5
|
+
#=========================================================================
|
6
|
+
# UTC(協定世界時) -> JST(日本標準時)
|
7
|
+
#
|
8
|
+
# * JST = UTC + 09:00
|
9
|
+
#
|
10
|
+
# @param: utc (Time Object)
|
11
|
+
# @return: jst (Time Object)
|
12
|
+
#=========================================================================
|
13
|
+
def utc2jst(utc)
|
14
|
+
jst = utc + Const::JST_OFFSET * 60 * 60
|
15
|
+
return Time.new(
|
16
|
+
jst.year, jst.month, jst.day,
|
17
|
+
jst.hour, jst.min, jst.sec,
|
18
|
+
sprintf("+%02d:00", Const::JST_OFFSET)
|
19
|
+
)
|
20
|
+
rescue => e
|
21
|
+
raise
|
22
|
+
end
|
23
|
+
|
24
|
+
#=========================================================================
|
25
|
+
# 年月日(グレゴリオ暦) -> JD(ユリウス日)
|
26
|
+
#
|
27
|
+
# * フリーゲルの公式を使用する
|
28
|
+
# JD = int(365.25 * year)
|
29
|
+
# + int(year / 400)
|
30
|
+
# - int(year / 100)
|
31
|
+
# + int(30.59 (month - 2))
|
32
|
+
# + day
|
33
|
+
# + 1721088
|
34
|
+
# * 上記の int(x) は厳密には、 x を超えない最大の整数
|
35
|
+
# * 「ユリウス日」でなく「準ユリウス日」を求めるなら、
|
36
|
+
# `+ 1721088` を `- 678912` とする。
|
37
|
+
#
|
38
|
+
# @param: t (Time Object)
|
39
|
+
# @return: jd (ユリウス日)
|
40
|
+
#=========================================================================
|
41
|
+
def gc2jd(t)
|
42
|
+
year, month, day = t.year, t.month, t.day
|
43
|
+
hour, min, sec = t.hour, t.min, t.sec
|
44
|
+
|
45
|
+
begin
|
46
|
+
# 1月,2月は前年の13月,14月とする
|
47
|
+
if month < 3
|
48
|
+
year -= 1
|
49
|
+
month += 12
|
50
|
+
end
|
51
|
+
# 日付(整数)部分計算
|
52
|
+
jd = (365.25 * year).floor \
|
53
|
+
+ (year / 400.0).floor \
|
54
|
+
- (year / 100.0).floor \
|
55
|
+
+ (30.59 * (month - 2)).floor \
|
56
|
+
+ day \
|
57
|
+
+ 1721088.5
|
58
|
+
# 時間(小数)部分計算
|
59
|
+
t = (sec / 3600.0 + min / 60.0 + hour) / 24.0
|
60
|
+
return jd + t
|
61
|
+
rescue => e
|
62
|
+
raise
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
#=========================================================================
|
67
|
+
# JD(ユリウス日) -> T(ユリウス世紀数)
|
68
|
+
#
|
69
|
+
# * t = (JD - 2451545) / 36525.0
|
70
|
+
#
|
71
|
+
# @param: jd (ユリウス日)
|
72
|
+
# @return: t (ユリウス世紀数)
|
73
|
+
#=========================================================================
|
74
|
+
def jd2t(jd)
|
75
|
+
return (jd - Const::J2000) / (Const::JY * 100)
|
76
|
+
rescue => e
|
77
|
+
raise
|
78
|
+
end
|
79
|
+
|
80
|
+
#=========================================================================
|
81
|
+
# UTC(協定世界時) - TAI(国際原子時) (= うるう秒総和) の取得
|
82
|
+
#
|
83
|
+
# * Ref: http://jjy.nict.go.jp/QandA/data/leapsec.html
|
84
|
+
#
|
85
|
+
# @param: utc (Time Object)
|
86
|
+
# @return: utc_tai (sec)
|
87
|
+
#=========================================================================
|
88
|
+
def get_utc_tai(utc)
|
89
|
+
utc_tai = 0
|
90
|
+
target = utc.strftime("%Y%m%d")
|
91
|
+
|
92
|
+
begin
|
93
|
+
Const::LEAP_SECS.reverse.each do |date, sec|
|
94
|
+
if date <= target
|
95
|
+
utc_tai = sec
|
96
|
+
break
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return utc_tai
|
100
|
+
rescue => e
|
101
|
+
raise
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#=========================================================================
|
106
|
+
# DUT1 (= UT1(世界時1) - UTC(協定世界時)) の取得
|
107
|
+
#
|
108
|
+
# * Ref: http://jjy.nict.go.jp/QandA/data/dut1.html
|
109
|
+
#
|
110
|
+
# @param: utc (Time Object)
|
111
|
+
# @return: dut1 (sec)
|
112
|
+
#=========================================================================
|
113
|
+
def get_dut1(utc)
|
114
|
+
dut1 = 0
|
115
|
+
target = utc.strftime("%Y%m%d")
|
116
|
+
|
117
|
+
begin
|
118
|
+
Const::DUT1S.reverse.each do |date, sec|
|
119
|
+
if date <= target
|
120
|
+
dut1 = sec
|
121
|
+
break
|
122
|
+
end
|
123
|
+
end
|
124
|
+
return dut1
|
125
|
+
rescue => e
|
126
|
+
raise
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
#=========================================================================
|
131
|
+
# UTC(協定世界時) -> UT1(世界時1)
|
132
|
+
#
|
133
|
+
# * UT1 = UTC + DUT1
|
134
|
+
#
|
135
|
+
# @param: utc (Time Object)
|
136
|
+
# @return: ut1 (Time Object)
|
137
|
+
#=========================================================================
|
138
|
+
def utc2ut1(utc)
|
139
|
+
return utc + Rational(@dut1)
|
140
|
+
rescue => e
|
141
|
+
raise
|
142
|
+
end
|
143
|
+
|
144
|
+
#=========================================================================
|
145
|
+
# UTC(協定世界時) -> TAI(国際原子時)
|
146
|
+
#
|
147
|
+
# * TAI = UTC - UTC_TAI
|
148
|
+
#
|
149
|
+
# @param: utc (Time Object)
|
150
|
+
# @return: tai (Time Object)
|
151
|
+
#=========================================================================
|
152
|
+
def utc2tai(utc)
|
153
|
+
return utc - @utc_tai
|
154
|
+
rescue => e
|
155
|
+
raise
|
156
|
+
end
|
157
|
+
|
158
|
+
#=========================================================================
|
159
|
+
# ΔT の計算
|
160
|
+
#
|
161
|
+
# * うるう秒調整が明確な場合は、うるう秒総和を使用した計算
|
162
|
+
# * そうでない場合は、NASA の計算式による計算
|
163
|
+
#
|
164
|
+
# @param: utc (Time Object)
|
165
|
+
# @return: dt (sec)
|
166
|
+
#=========================================================================
|
167
|
+
def calc_dt(utc)
|
168
|
+
return Rational(Const::TT_TAI, 1000) - @utc_tai - @dut1 unless @utc_tai == 0
|
169
|
+
y = utc.year + (utc.month - 0.5) / 12
|
170
|
+
case
|
171
|
+
when utc.year < -500; dt = calc_dt_before_m500(y)
|
172
|
+
when -500 <= utc.year && utc.year < 500; dt = calc_dt_before_500(y)
|
173
|
+
when 500 <= utc.year && utc.year < 1600; dt = calc_dt_before_1600(y)
|
174
|
+
when 1600 <= utc.year && utc.year < 1700; dt = calc_dt_before_1700(y)
|
175
|
+
when 1700 <= utc.year && utc.year < 1800; dt = calc_dt_before_1800(y)
|
176
|
+
when 1800 <= utc.year && utc.year < 1860; dt = calc_dt_before_1860(y)
|
177
|
+
when 1860 <= utc.year && utc.year < 1900; dt = calc_dt_before_1900(y)
|
178
|
+
when 1900 <= utc.year && utc.year < 1920; dt = calc_dt_before_1920(y)
|
179
|
+
when 1920 <= utc.year && utc.year < 1941; dt = calc_dt_before_1941(y)
|
180
|
+
when 1941 <= utc.year && utc.year < 1961; dt = calc_dt_before_1961(y)
|
181
|
+
when 1961 <= utc.year && utc.year < 1986; dt = calc_dt_before_1986(y)
|
182
|
+
when 1986 <= utc.year && utc.year < 2005; dt = calc_dt_before_2005(y)
|
183
|
+
when 2005 <= utc.year && utc.year < 2050; dt = calc_dt_before_2050(y)
|
184
|
+
when 2050 <= utc.year && utc.year <= 2150; dt = calc_dt_until_2150(y)
|
185
|
+
when 2150 < utc.year ; dt = calc_dt_after_2150(y)
|
186
|
+
end
|
187
|
+
return dt
|
188
|
+
rescue => e
|
189
|
+
raise
|
190
|
+
end
|
191
|
+
|
192
|
+
#=========================================================================
|
193
|
+
# deltaT (year < -500)
|
194
|
+
#
|
195
|
+
# @param: y (Year coefficient for deltaT calculation)
|
196
|
+
# @return: dt (sec)
|
197
|
+
#=========================================================================
|
198
|
+
def calc_dt_before_m500(y)
|
199
|
+
t = (y - 1820) / 100.0
|
200
|
+
dt = -20 + 32 * t ** 2
|
201
|
+
return dt
|
202
|
+
rescue => e
|
203
|
+
raise
|
204
|
+
end
|
205
|
+
|
206
|
+
#=========================================================================
|
207
|
+
# deltaT (-500 <= year && year < 500)
|
208
|
+
#
|
209
|
+
# @param: y (Year coefficient for deltaT calculation)
|
210
|
+
# @return: dt (sec)
|
211
|
+
#=========================================================================
|
212
|
+
def calc_dt_before_500(y)
|
213
|
+
t = y / 100.0
|
214
|
+
dt = 10583.6
|
215
|
+
(-1014.41 + \
|
216
|
+
( 33.78311 + \
|
217
|
+
( -5.952053 + \
|
218
|
+
( -0.1798452 + \
|
219
|
+
( 0.022174192 + \
|
220
|
+
( 0.0090316521) \
|
221
|
+
* t) * t) * t) * t) * t) * t
|
222
|
+
return dt
|
223
|
+
rescue => e
|
224
|
+
raise
|
225
|
+
end
|
226
|
+
|
227
|
+
#=========================================================================
|
228
|
+
# deltaT (500 <= year && year < 1600)
|
229
|
+
#
|
230
|
+
# @param: y (Year coefficient for deltaT calculation)
|
231
|
+
# @return: dt (sec)
|
232
|
+
#=========================================================================
|
233
|
+
def calc_dt_before_1600(y)
|
234
|
+
t = (y - 1000) / 100.0
|
235
|
+
dt = 1574.2 + \
|
236
|
+
(-556.01 + \
|
237
|
+
( 71.23472 + \
|
238
|
+
( 0.319781 + \
|
239
|
+
( -0.8503463 + \
|
240
|
+
( -0.005050998 + \
|
241
|
+
( 0.0083572073) \
|
242
|
+
* t) * t) * t) * t) * t) * t
|
243
|
+
return dt
|
244
|
+
rescue => e
|
245
|
+
raise
|
246
|
+
end
|
247
|
+
|
248
|
+
#=========================================================================
|
249
|
+
# deltaT (1600 <= year && year < 1700)
|
250
|
+
#
|
251
|
+
# @param: y (Year coefficient for deltaT calculation)
|
252
|
+
# @return: dt (sec)
|
253
|
+
#=========================================================================
|
254
|
+
def calc_dt_before_1700(y)
|
255
|
+
t = y - 1600
|
256
|
+
dt = 120 + \
|
257
|
+
( -0.9808 + \
|
258
|
+
( -0.01532 + \
|
259
|
+
( 1.0 / 7129.0) \
|
260
|
+
* t) * t) * t
|
261
|
+
return dt
|
262
|
+
rescue => e
|
263
|
+
raise
|
264
|
+
end
|
265
|
+
|
266
|
+
#=========================================================================
|
267
|
+
# deltaT (1700 <= year && year < 1800)
|
268
|
+
#
|
269
|
+
# @param: y (Year coefficient for deltaT calculation)
|
270
|
+
# @return: dt (sec)
|
271
|
+
#=========================================================================
|
272
|
+
def calc_dt_before_1800(y)
|
273
|
+
t = y - 1700
|
274
|
+
dt = 8.83 + \
|
275
|
+
( 0.1603 + \
|
276
|
+
(-0.0059285 + \
|
277
|
+
( 0.00013336 + \
|
278
|
+
(-1.0 / 1174000.0) \
|
279
|
+
* t) * t) * t) * t
|
280
|
+
return dt
|
281
|
+
rescue => e
|
282
|
+
raise
|
283
|
+
end
|
284
|
+
|
285
|
+
#=========================================================================
|
286
|
+
# deltaT (1800 <= year && year < 1860)
|
287
|
+
#
|
288
|
+
# @param: y (Year coefficient for deltaT calculation)
|
289
|
+
# @return: dt (sec)
|
290
|
+
#=========================================================================
|
291
|
+
def calc_dt_before_1860(y)
|
292
|
+
t = y - 1800
|
293
|
+
dt = 13.72 + \
|
294
|
+
(-0.332447 + \
|
295
|
+
( 0.0068612 + \
|
296
|
+
( 0.0041116 + \
|
297
|
+
(-0.00037436 + \
|
298
|
+
( 0.0000121272 + \
|
299
|
+
(-0.0000001699 + \
|
300
|
+
( 0.000000000875) \
|
301
|
+
* t) * t) * t) * t) * t) * t) * t
|
302
|
+
return dt
|
303
|
+
rescue => e
|
304
|
+
raise
|
305
|
+
end
|
306
|
+
|
307
|
+
#=========================================================================
|
308
|
+
# deltaT (1860 <= year && year < 1900)
|
309
|
+
#
|
310
|
+
# @param: y (Year coefficient for deltaT calculation)
|
311
|
+
# @return: dt (sec)
|
312
|
+
#=========================================================================
|
313
|
+
def calc_dt_before_1900(y)
|
314
|
+
t = y - 1860
|
315
|
+
dt = 7.62 + \
|
316
|
+
( 0.5737 + \
|
317
|
+
(-0.251754 + \
|
318
|
+
( 0.01680668 + \
|
319
|
+
(-0.0004473624 + \
|
320
|
+
( 1.0 / 233174.0) \
|
321
|
+
* t) * t) * t) * t) * t
|
322
|
+
return dt
|
323
|
+
rescue => e
|
324
|
+
raise
|
325
|
+
end
|
326
|
+
|
327
|
+
#=========================================================================
|
328
|
+
# deltaT (1900 <= year && year < 1920)
|
329
|
+
#
|
330
|
+
# @param: y (Year coefficient for deltaT calculation)
|
331
|
+
# @return: dt (sec)
|
332
|
+
#=========================================================================
|
333
|
+
def calc_dt_before_1920(y)
|
334
|
+
t = y - 1900
|
335
|
+
dt = -2.79 + \
|
336
|
+
( 1.494119 + \
|
337
|
+
(-0.0598939 + \
|
338
|
+
( 0.0061966 + \
|
339
|
+
(-0.000197 ) \
|
340
|
+
* t) * t) * t) * t
|
341
|
+
return dt
|
342
|
+
rescue => e
|
343
|
+
raise
|
344
|
+
end
|
345
|
+
|
346
|
+
#=========================================================================
|
347
|
+
# deltaT (1920 <= year && year < 1941)
|
348
|
+
#
|
349
|
+
# @param: y (Year coefficient for deltaT calculation)
|
350
|
+
# @return: dt (sec)
|
351
|
+
#=========================================================================
|
352
|
+
def calc_dt_before_1941(y)
|
353
|
+
t = y - 1920
|
354
|
+
dt = 21.20 + \
|
355
|
+
( 0.84493 + \
|
356
|
+
(-0.076100 + \
|
357
|
+
( 0.0020936) \
|
358
|
+
* t) * t) * t
|
359
|
+
return dt
|
360
|
+
rescue => e
|
361
|
+
raise
|
362
|
+
end
|
363
|
+
|
364
|
+
#=========================================================================
|
365
|
+
# deltaT (1941 <= year && year < 1961)
|
366
|
+
#
|
367
|
+
# @param: y (Year coefficient for deltaT calculation)
|
368
|
+
# @return: dt (sec)
|
369
|
+
#=========================================================================
|
370
|
+
def calc_dt_before_1961(y)
|
371
|
+
t = y - 1950
|
372
|
+
dt = 29.07 + \
|
373
|
+
( 0.407 + \
|
374
|
+
(-1 / 233.0 + \
|
375
|
+
( 1 / 2547.0) \
|
376
|
+
* t) * t) * t
|
377
|
+
return dt
|
378
|
+
rescue => e
|
379
|
+
raise
|
380
|
+
end
|
381
|
+
|
382
|
+
#=========================================================================
|
383
|
+
# deltaT (1961 <= year && year < 1986)
|
384
|
+
#
|
385
|
+
# @param: y (Year coefficient for deltaT calculation)
|
386
|
+
# @return: dt (sec)
|
387
|
+
#=========================================================================
|
388
|
+
def calc_dt_before_1986(y)
|
389
|
+
t = y - 1975
|
390
|
+
dt = 45.45 + \
|
391
|
+
( 1.067 + \
|
392
|
+
(-1 / 260.0 + \
|
393
|
+
(-1 / 718.0) \
|
394
|
+
* t) * t) * t
|
395
|
+
return dt
|
396
|
+
rescue => e
|
397
|
+
raise
|
398
|
+
end
|
399
|
+
|
400
|
+
#=========================================================================
|
401
|
+
# deltaT (1986 <= year && year < 2005)
|
402
|
+
#
|
403
|
+
# @param: y (Year coefficient for deltaT calculation)
|
404
|
+
# @return: dt (sec)
|
405
|
+
#=========================================================================
|
406
|
+
def calc_dt_before_2005(y)
|
407
|
+
t = y - 2000
|
408
|
+
dt = 63.86 + \
|
409
|
+
( 0.3345 + \
|
410
|
+
(-0.060374 + \
|
411
|
+
( 0.0017275 + \
|
412
|
+
( 0.000651814 + \
|
413
|
+
( 0.00002373599) \
|
414
|
+
* t) * t) * t) * t) * t
|
415
|
+
return dt
|
416
|
+
rescue => e
|
417
|
+
raise
|
418
|
+
end
|
419
|
+
|
420
|
+
#=========================================================================
|
421
|
+
# deltaT (2005 <= year && year < 2050)
|
422
|
+
#
|
423
|
+
# @param: y (Year coefficient for deltaT calculation)
|
424
|
+
# @return: dt (sec)
|
425
|
+
#=========================================================================
|
426
|
+
def calc_dt_before_2050(y)
|
427
|
+
t = y - 2000
|
428
|
+
dt = 62.92 + \
|
429
|
+
( 0.32217 + \
|
430
|
+
( 0.005589) \
|
431
|
+
* t) * t
|
432
|
+
return dt
|
433
|
+
rescue => e
|
434
|
+
raise
|
435
|
+
end
|
436
|
+
|
437
|
+
#=========================================================================
|
438
|
+
# deltaT (2050 <= year && year <= 2150)
|
439
|
+
#
|
440
|
+
# @param: y (Year coefficient for deltaT calculation)
|
441
|
+
# @return: dt (sec)
|
442
|
+
#=========================================================================
|
443
|
+
def calc_dt_until_2150(y)
|
444
|
+
dt = -20 \
|
445
|
+
+ 32 * ((y - 1820) / 100.0) ** 2
|
446
|
+
- 0.5628 * (2150 - y)
|
447
|
+
return dt
|
448
|
+
rescue => e
|
449
|
+
raise
|
450
|
+
end
|
451
|
+
|
452
|
+
#=========================================================================
|
453
|
+
# deltaT (2150 < year)
|
454
|
+
#
|
455
|
+
# @param: y (Year coefficient for deltaT calculation)
|
456
|
+
# @return: dt (sec)
|
457
|
+
#=========================================================================
|
458
|
+
def calc_dt_after_2150(y)
|
459
|
+
t = (y - 1820) / 100.0
|
460
|
+
dt = -20 + 32 * t ** 2
|
461
|
+
return dt
|
462
|
+
rescue => e
|
463
|
+
raise
|
464
|
+
end
|
465
|
+
|
466
|
+
#=========================================================================
|
467
|
+
# TT(地球時)
|
468
|
+
#
|
469
|
+
# * TT = TAI + TT_TAI
|
470
|
+
# = UT1 + ΔT
|
471
|
+
#=========================================================================
|
472
|
+
def tai2tt(tai)
|
473
|
+
return tai + Rational(Const::TT_TAI, 1000)
|
474
|
+
rescue => e
|
475
|
+
raise
|
476
|
+
end
|
477
|
+
|
478
|
+
#=========================================================================
|
479
|
+
# TCG(地球重心座標時)
|
480
|
+
#
|
481
|
+
# * TCG = TT + L_G * (JD - T_0) * 86,400
|
482
|
+
# (JD: ユリウス日,
|
483
|
+
# L_G = 6.969290134 * 10^(-10), T_0 = 2,443,144.5003725)
|
484
|
+
#
|
485
|
+
# @param: tt (Time Object)
|
486
|
+
# @return: tcg (Time Object)
|
487
|
+
#=========================================================================
|
488
|
+
def tt2tcg(tt)
|
489
|
+
return tt + Const::L_G * (@jd - Const::T_0) * 86400
|
490
|
+
rescue => e
|
491
|
+
raise
|
492
|
+
end
|
493
|
+
|
494
|
+
#=========================================================================
|
495
|
+
# TCB(太陽系重心座標時)
|
496
|
+
#
|
497
|
+
# * TCB = TT + L_B * (JD - T_0) * 86400
|
498
|
+
#
|
499
|
+
# @param: tt (Time Object)
|
500
|
+
# @return: tcb (Time Object)
|
501
|
+
#=========================================================================
|
502
|
+
def tt2tcb(tt)
|
503
|
+
return tt + Const::L_B * (@jd - Const::T_0) * 86400
|
504
|
+
rescue => e
|
505
|
+
raise
|
506
|
+
end
|
507
|
+
|
508
|
+
#=========================================================================
|
509
|
+
# TCB(太陽系重心座標時) -> TDB(太陽系力学時)
|
510
|
+
#
|
511
|
+
# * TDB = TCB - L_B * (JD_TCB - T_0) * 86400 + TDB_0
|
512
|
+
#
|
513
|
+
# @param: tcb (Time Object)
|
514
|
+
# @return: tdb (Time Object)
|
515
|
+
#=========================================================================
|
516
|
+
def tcb2tdb(tcb)
|
517
|
+
jd_tcb = gc2jd(tcb)
|
518
|
+
return tcb - Const::L_B * (jd_tcb - Const::T_0) * 86400 + Const::TDB_0
|
519
|
+
rescue => e
|
520
|
+
raise
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
@@ -0,0 +1,179 @@
|
|
1
|
+
module MkTime
|
2
|
+
module Const
|
3
|
+
MSG_ERR_1 = "[ERROR] Format: YYYYMMDD or YYYYMMDDHHMMSS"
|
4
|
+
MSG_ERR_2 = "[ERROR] Invalid date-time!"
|
5
|
+
JST_OFFSET = 9 # JST offset from UTC
|
6
|
+
J2000 = 2451545 # Julian Day of 2000-01-01 12:00:00
|
7
|
+
JY = 365.25 # 1 Julian Year
|
8
|
+
TT_TAI = 32184 # (TT - TAI) * 1000 (計算時の誤差抑制のため 1000 倍している)
|
9
|
+
L_G = 6.969290134e-10 # for TCG
|
10
|
+
L_B = 1.550519768e-8 # for TCG, TDB
|
11
|
+
T_0 = 2443144.5003725 # for TCG, TDB, TCB
|
12
|
+
TDB_0 = -6.55e-5 # for TDB
|
13
|
+
LEAP_SECS = [
|
14
|
+
["19720101", -10],
|
15
|
+
["19720701", -11],
|
16
|
+
["19730101", -12],
|
17
|
+
["19740101", -13],
|
18
|
+
["19750101", -14],
|
19
|
+
["19760101", -15],
|
20
|
+
["19770101", -16],
|
21
|
+
["19780101", -17],
|
22
|
+
["19790101", -18],
|
23
|
+
["19800101", -19],
|
24
|
+
["19810701", -20],
|
25
|
+
["19820701", -21],
|
26
|
+
["19830701", -22],
|
27
|
+
["19850701", -23],
|
28
|
+
["19880101", -24],
|
29
|
+
["19900101", -25],
|
30
|
+
["19910101", -26],
|
31
|
+
["19920701", -27],
|
32
|
+
["19930701", -28],
|
33
|
+
["19940701", -29],
|
34
|
+
["19960101", -30],
|
35
|
+
["19970701", -31],
|
36
|
+
["19990101", -32],
|
37
|
+
["20060101", -33],
|
38
|
+
["20090101", -34],
|
39
|
+
["20120701", -35],
|
40
|
+
["20150701", -36],
|
41
|
+
["20170101", -37],
|
42
|
+
["20190101", 0] # (<= Provisional end point)
|
43
|
+
].freeze # Leap Second's adjustment
|
44
|
+
DUT1S = [
|
45
|
+
["19880317", 0.2],
|
46
|
+
["19880512", 0.1],
|
47
|
+
["19880825", 0.0],
|
48
|
+
["19881110", -0.1],
|
49
|
+
["19890119", -0.2],
|
50
|
+
["19890406", -0.3],
|
51
|
+
["19890608", -0.4],
|
52
|
+
["19890921", -0.5],
|
53
|
+
["19891116", -0.6],
|
54
|
+
["19900101", 0.3],
|
55
|
+
["19900301", 0.2],
|
56
|
+
["19900412", 0.1],
|
57
|
+
["19900510", 0.0],
|
58
|
+
["19900726", -0.1],
|
59
|
+
["19900920", -0.2],
|
60
|
+
["19901101", -0.3],
|
61
|
+
["19910101", 0.6],
|
62
|
+
["19910207", 0.5],
|
63
|
+
["19910321", 0.4],
|
64
|
+
["19910425", 0.3],
|
65
|
+
["19910620", 0.2],
|
66
|
+
["19910822", 0.1],
|
67
|
+
["19911017", 0.0],
|
68
|
+
["19911121", -0.1],
|
69
|
+
["19920123", -0.2],
|
70
|
+
["19920227", -0.3],
|
71
|
+
["19920402", -0.4],
|
72
|
+
["19920507", -0.5],
|
73
|
+
["19920701", 0.4],
|
74
|
+
["19920903", 0.3],
|
75
|
+
["19921022", 0.2],
|
76
|
+
["19921126", 0.1],
|
77
|
+
["19930114", 0.0],
|
78
|
+
["19930218", -0.1],
|
79
|
+
["19930401", -0.2],
|
80
|
+
["19930506", -0.3],
|
81
|
+
["19930701", 0.6],
|
82
|
+
["19930819", 0.5],
|
83
|
+
["19931007", 0.4],
|
84
|
+
["19931118", 0.3],
|
85
|
+
["19931230", 0.2],
|
86
|
+
["19940210", 0.1],
|
87
|
+
["19940317", 0.0],
|
88
|
+
["19940421", -0.1],
|
89
|
+
["19940609", -0.2],
|
90
|
+
["19940701", 0.8],
|
91
|
+
["19940811", 0.7],
|
92
|
+
["19941006", 0.6],
|
93
|
+
["19941117", 0.5],
|
94
|
+
["19941222", 0.4],
|
95
|
+
["19950223", 0.3],
|
96
|
+
["19950316", 0.2],
|
97
|
+
["19950413", 0.1],
|
98
|
+
["19950525", 0.0],
|
99
|
+
["19950713", -0.1],
|
100
|
+
["19950907", -0.2],
|
101
|
+
["19951026", -0.3],
|
102
|
+
["19951130", -0.4],
|
103
|
+
["19960101", 0.5],
|
104
|
+
["19960222", 0.4],
|
105
|
+
["19960411", 0.3],
|
106
|
+
["19960516", 0.2],
|
107
|
+
["19960808", 0.1],
|
108
|
+
["19961003", 0.0],
|
109
|
+
["19961205", -0.1],
|
110
|
+
["19970206", -0.2],
|
111
|
+
["19970320", -0.3],
|
112
|
+
["19970508", -0.4],
|
113
|
+
["19970626", -0.5],
|
114
|
+
["19970701", 0.5],
|
115
|
+
["19970918", 0.4],
|
116
|
+
["19971030", 0.3],
|
117
|
+
["19971218", 0.2],
|
118
|
+
["19980219", 0.1],
|
119
|
+
["19980326", 0.0],
|
120
|
+
["19980507", -0.1],
|
121
|
+
["19980813", -0.2],
|
122
|
+
["19981126", -0.3],
|
123
|
+
["19990101", 0.7],
|
124
|
+
["19990304", 0.6],
|
125
|
+
["19990527", 0.5],
|
126
|
+
["19991014", 0.4],
|
127
|
+
["20000106", 0.3],
|
128
|
+
["20000413", 0.2],
|
129
|
+
["20001019", 0.1],
|
130
|
+
["20010301", 0.0],
|
131
|
+
["20011004", -0.1],
|
132
|
+
["20020214", -0.2],
|
133
|
+
["20021024", -0.3],
|
134
|
+
["20030403", -0.4],
|
135
|
+
["20040429", -0.5],
|
136
|
+
["20050317", -0.6],
|
137
|
+
["20060101", 0.3],
|
138
|
+
["20060427", 0.2],
|
139
|
+
["20060928", 0.1],
|
140
|
+
["20061222", 0.0],
|
141
|
+
["20070315", -0.1],
|
142
|
+
["20070614", -0.2],
|
143
|
+
["20071129", -0.3],
|
144
|
+
["20080313", -0.4],
|
145
|
+
["20080807", -0.5],
|
146
|
+
["20081120", -0.6],
|
147
|
+
["20090101", 0.4],
|
148
|
+
["20090312", 0.3],
|
149
|
+
["20090611", 0.2],
|
150
|
+
["20091112", 0.1],
|
151
|
+
["20100311", 0.0],
|
152
|
+
["20100603", -0.1],
|
153
|
+
["20110106", -0.2],
|
154
|
+
["20110512", -0.3],
|
155
|
+
["20111104", -0.4],
|
156
|
+
["20120209", -0.5],
|
157
|
+
["20120510", -0.6],
|
158
|
+
["20120701", 0.4],
|
159
|
+
["20121025", 0.3],
|
160
|
+
["20130131", 0.2],
|
161
|
+
["20130411", 0.1],
|
162
|
+
["20130822", 0.0],
|
163
|
+
["20131121", -0.1],
|
164
|
+
["20140220", -0.2],
|
165
|
+
["20140508", -0.3],
|
166
|
+
["20140925", -0.4],
|
167
|
+
["20141225", -0.5],
|
168
|
+
["20150319", -0.6],
|
169
|
+
["20150528", -0.7],
|
170
|
+
["20150701", 0.3],
|
171
|
+
["20150917", 0.2],
|
172
|
+
["20151126", 0.1],
|
173
|
+
["20160131", 0.0],
|
174
|
+
["20160324", -0.1],
|
175
|
+
["20160519", -0.2],
|
176
|
+
["20160819", 0.0] # (<= Provisional end point)
|
177
|
+
].freeze # DUT1 adjustment
|
178
|
+
end
|
179
|
+
end
|
data/mk_time.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mk_time/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mk_time"
|
8
|
+
spec.version = MkTime::VERSION
|
9
|
+
spec.authors = ["komasaru"]
|
10
|
+
spec.email = ["masaru@mk-mode.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Time system conversion library.}
|
13
|
+
spec.description = %q{MkTime is a time system conversion library.}
|
14
|
+
spec.homepage = "https://github.com/komasaru/mk_time"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mk_time
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- komasaru
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: MkTime is a time system conversion library.
|
56
|
+
email:
|
57
|
+
- masaru@mk-mode.com
|
58
|
+
executables:
|
59
|
+
- mk_time
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- Guardfile
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- exe/mk_time
|
74
|
+
- lib/mk_time.rb
|
75
|
+
- lib/mk_time/argument.rb
|
76
|
+
- lib/mk_time/calc.rb
|
77
|
+
- lib/mk_time/compute.rb
|
78
|
+
- lib/mk_time/consts.rb
|
79
|
+
- lib/mk_time/version.rb
|
80
|
+
- mk_time.gemspec
|
81
|
+
homepage: https://github.com/komasaru/mk_time
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.6.6
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Time system conversion library.
|
105
|
+
test_files: []
|