class EphJcg::TimeCalculator
Attributes
day[R]
dt[R]
f[R]
hour[R]
min[R]
month[R]
sec[R]
t[R]
tm[R]
tm_r[R]
year[R]
Public Class Methods
new(utc)
click to toggle source
# File lib/eph_jcg/time_calculator.rb, line 6 def initialize(utc) @utc = utc tm = Time.at(utc) @year, @month, @day = tm.year, tm.month, tm.day @hour, @min, @sec = tm.hour, tm.min, tm.sec end
Public Instance Methods
calc()
click to toggle source
# File lib/eph_jcg/time_calculator.rb, line 13 def calc @t = calc_t @f = calc_f @dt = get_delta_t @tm, @tm_r = calc_tm(@t, @f, @dt) end
Private Instance Methods
calc_f()
click to toggle source
calc_t()
click to toggle source
¶ ↑
通日 T の計算 * 通日 T は1月0日を第0日とした通算日数で、次式により求める。 T = 30 * P + Q * (S - Y) + P * (1 - Q) + 日 但し、 P = 月 - 1, Q = [(月 + 7) / 10] Y = [(年 / 4) - [(年 / 4)] + 0.77] S = [P * 0.55 - 0.33] で、[] は整数部のみを抜き出すことを意味する。
¶ ↑
# File lib/eph_jcg/time_calculator.rb, line 33 def calc_t p = @month - 1 q = ((@month + 7) / 10.0).to_i y = ((@year / 4.0) - (@year / 4.0).to_i + 0.77).to_i s = (p * 0.55 - 0.33).to_i return 30 * p + q * (s - y) + p * (1 - q) + @day end
calc_tm(t, f, dt)
click to toggle source