Class: When::TimeStandard::UniversalTime

Inherits:
TimeStandard show all
Defined in:
lib/when_exe/timestandard.rb

Overview

協定世界時

Constant Summary

Constants inherited from TimeStandard

TimeStandard::Ratio

Constants included from When::TimeStandard

DeltaT, DeltaT0, TAI_UTC

Constants included from Parts::Resource

Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues

Instance Attribute Summary

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from TimeStandard

#from_dynamical_date, #from_dynamical_time, #rate_of_clock, #to_dynamical_date, #to_dynamical_time

Methods included from When::TimeStandard

_is_systemtime_universal?, _leap_seconds, _setup_, delta_t, delta_t_coordinated, delta_t_observed, from_dynamical_time, from_time_object, to_dynamical_time, to_time_object

Methods inherited from BasicTypes::Object

#tap

Methods included from Parts::Resource

#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #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

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#from_time_object(time) ⇒ Numeric

Time オブジェクトを universal time に変換する

Parameters:

Returns:



368
369
370
371
372
# File 'lib/when_exe/timestandard.rb', line 368

def from_time_object(time)
  result = time.to_f * When::TM::Duration::SECOND
  return result if When::TimeStandard._is_systemtime_universal?
  from_dynamical_time(result + DeltaT0)
end

#has_leap?Boolean

当該時刻系に閏秒があるか?

Returns:

  • (Boolean)
    • true 閏秒あり



389
390
391
# File 'lib/when_exe/timestandard.rb', line 389

def has_leap?
  true
end

#to_time_object(time) ⇒ ::Time

universal time を Time オブジェクトに変換する

Parameters:

  • time (Numeric)

    universal time

Returns:



380
381
382
383
# File 'lib/when_exe/timestandard.rb', line 380

def to_time_object(time)
  time = to_dynamical_time(time) - DeltaT0 unless When::TimeStandard._is_systemtime_universal?
  ::Time.at(+time / When::TM::Duration::SECOND)
end