Method: When::TimeStandard::TemporalHourSystem#from_dynamical_time
- Defined in:
- lib/when_exe/timestandard.rb
#from_dynamical_time(time) ⇒ Numeric
dynamical time を temporal hour system に変換する
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/when_exe/timestandard.rb', line 668 def from_dynamical_time(time) date = When::TM::JulianDate._t_to_d(time) d, t = [-1, +1].map {|v| @formula.day_event(date, v, When.Resource('_ep:Sun'), @height)} if date < d # after midnight t = @formula.sunset(date-1, @height) f = (date - t) / (d - t) / 2 - 0.25 elsif date > t # before midnight d = @formula.sunrise(date+1, @height) f = (date - t) / (d - t) / 2 - 0.25 else # day time f = (date - d) / (t - d) / 2 + 0.25 end When::TM::JulianDate._d_to_t(_from_dynamical_date(d).floor + 0.5 + f) end |