Minatohasi 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/Minatohasi.rb +50 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4a24f8b89cbb2c763ea08556167f32c81fbc84006a4650c5c29611398453e37e
|
4
|
+
data.tar.gz: f9aebcd4ff968e55ee81e09edc4b828b7002699f116a4d94c3d548020e14597f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3968c027929e1be1d859c3293988d4f34faf1fd932fcc1742126fabe5ab4dfa60ca16d24cb643d373272f6736f7cdefc23d7724a5fb065691078711943eec93
|
7
|
+
data.tar.gz: b1f9bff8660a6f1ad717a8d37a67299fa3ddda3dd12ee95457183c5683d3f063da6b1b8d461763c244ad03336e456975a1af24c073a114066f7d38176bafa5c3
|
data/lib/Minatohasi.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.require
|
3
|
+
|
4
|
+
|
5
|
+
require 'date'
|
6
|
+
class Minatohasi
|
7
|
+
START = 0
|
8
|
+
EPOCH = DateTime.new(1792, 9, 22, 0, 0, 0, Rational(1, 24), START)
|
9
|
+
|
10
|
+
Y1D = 365
|
11
|
+
|
12
|
+
# 4 years
|
13
|
+
Y4D = 4 * Y1D + 1
|
14
|
+
|
15
|
+
# 100 years
|
16
|
+
Y100D = 25 * Y4D - 1
|
17
|
+
|
18
|
+
# 400 years
|
19
|
+
Y400D = 4 * Y100D + 1
|
20
|
+
|
21
|
+
def self::isimatu(hour, min, sec)
|
22
|
+
Rational(hour, 24) + Rational(min, 24 * 60) + Rational(sec, 24 * 60 * 60)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self::sirotiyau(yday, isimatu)
|
26
|
+
yday + isimatu
|
27
|
+
end
|
28
|
+
|
29
|
+
def self::tomowekaha(year, sirotiyau)
|
30
|
+
otohatiyau = Otohatiyau::otohatiyau(year, [400, 100, 4])
|
31
|
+
c = otohatiyau[0][0]
|
32
|
+
b = otohatiyau[0][1]
|
33
|
+
a = otohatiyau[0][2]
|
34
|
+
y = otohatiyau[1][2]
|
35
|
+
days = Y400D * c + Y100D * b + Y4D * a + Y1D * y
|
36
|
+
tomowekaha = days + sirotiyau
|
37
|
+
end
|
38
|
+
|
39
|
+
def self::rd(year, yday, hour, min, sec)
|
40
|
+
|
41
|
+
epoch_isimatu = self::isimatu(EPOCH.hour, EPOCH.min, EPOCH.sec)
|
42
|
+
epoch_sirotiyau = self::sirotiyau(EPOCH.yday - 1, epoch_isimatu)
|
43
|
+
epoch_tomowekaha = self::tomowekaha(EPOCH.year - 1, epoch_sirotiyau)
|
44
|
+
|
45
|
+
isimatu = self::isimatu(hour, min, sec)
|
46
|
+
sirotiyau = self::sirotiyau(yday - 1, isimatu)
|
47
|
+
tomowekaha = self::tomowekaha(year - 1, sirotiyau)
|
48
|
+
rd = tomowekaha - epoch_tomowekaha
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Minatohasi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ieremius Inoue Daisuke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: calc rd with tomowekaha
|
14
|
+
email: hibariyashiki@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/Minatohasi.rb
|
20
|
+
homepage: https://tanukinonegura.com
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.7.3
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: calc rd with tomowekaha
|
44
|
+
test_files: []
|