Class: When::TimeStandard::TemporalHourSystem
- Inherits:
-
LocalApparentTime
- Object
- BasicTypes::Object
- TimeStandard
- LocalApparentTime
- When::TimeStandard::TemporalHourSystem
- Defined in:
- lib/when_exe/timestandard.rb
Overview
不定時法
Constant Summary
Constants inherited from TimeStandard
When::TimeStandard::TimeStandard::Ratio
Constants included from When::TimeStandard
DeltaT, DeltaT0, DeltaThreshold, TAI_UTC, YearThreshold
Constants included from Parts::Resource
Parts::Resource::LabelProperty
Instance Attribute Summary
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
- #_from_dynamical_time ⇒ Object
- #_to_dynamical_time ⇒ Object
-
#from_dynamical_time(time) ⇒ Numeric
dynamical time を temporal hour system に変換する.
-
#to_dynamical_time(time) ⇒ Numeric
temporal hour system を dynamical time に変換する.
Methods inherited from TimeStandard
#from_dynamical_date, #from_time_object, #has_leap?, #rate_of_clock, #to_dynamical_date, #to_time_object
Methods included from When::TimeStandard
_is_systemtime_universal?, _leap_seconds, _setup_, delta_t, delta_t_coordinated, delta_t_observed, delta_t_observed_nasa, delta_t_observed_poly, from_dynamical_time, from_time_object, to_dynamical_time, to_time_object
Methods inherited from BasicTypes::Object
Methods included from Parts::Resource
#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?
Methods included from Parts::Resource::Pool
#[], #[]=, #_pool, #_setup_, #pool_keys
Methods included from Parts::Resource::Synchronize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Method Details
#_from_dynamical_time ⇒ Object
522 |
# File 'lib/when_exe/timestandard.rb', line 522 alias :_from_dynamical_time :from_dynamical_time |
#_to_dynamical_time ⇒ Object
520 |
# File 'lib/when_exe/timestandard.rb', line 520 alias :_to_dynamical_time :to_dynamical_time |
#from_dynamical_time(time) ⇒ Numeric
dynamical time を temporal hour system に変換する
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
# File 'lib/when_exe/timestandard.rb', line 553 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.sun_set(date-1, @height) f = (date - t) / (d - t) / 2 - 0.25 elsif date > t # before midnight d = @formula.sun_rise(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 |
#to_dynamical_time(time) ⇒ Numeric
temporal hour system を dynamical time に変換する
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
# File 'lib/when_exe/timestandard.rb', line 530 def to_dynamical_time(time) noon, frac = When::TM::JulianDate._t_to_d(time).divmod(1) r, *p = case (frac * 4).floor when 3 ; [-1.5, [noon+1, -1],[noon+1, +1]] # morning when 0 ; [+0.5, [noon, -1],[noon, +1]] # afternoon else ; [-0.5, [noon, +1],[noon+1, -1]] # night end s, e = p.map {|v| When::TM::JulianDate._d_to_t(@formula.day_event(_to_dynamical_date(v[0]), v[1], When.Resource('_ep:Sun'), @height)) } s + (e - s) * (frac * 2 + r) end |