Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/when_exe/core/duration.rb,
lib/when_exe/core/extension.rb,
lib/when_exe/mini_application.rb

Overview

Time for v1.8.x compatibility

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ ::Time

加算

Parameters:

  • other (When::TM::Duration)

    加える時間間隔(他の型の場合は動作に変更なし)

Returns:



87
88
89
# File 'lib/when_exe/core/duration.rb', line 87

def +(other)
  other.kind_of?(When::TM::Duration) ? self + other.to_f : self._plus_(other)
end

#-(other) ⇒ ::Time

減算

Parameters:

  • other (When::TM::Duration)

    減じる時間間隔(他の型の場合は動作に変更なし)

Returns:



100
101
102
# File 'lib/when_exe/core/duration.rb', line 100

def -(other)
  other.kind_of?(When::TM::Duration) ? self - other.to_f : self._minus_(other)
end

#julian_date(options = {}) ⇒ When::TM::JulianDate Also known as: to_julian_date

Note:

core/extension

対応する When::TM::JulianDate を生成

Parameters:

  • options (Hash) (defaults to: {})

    以下の通り

Options Hash (options):

Returns:



29
30
31
32
# File 'lib/when_exe/core/extension.rb', line 29

def julian_date(options={})
  options[:clock] ||= Clock(self.utc_offset)
  When::TM::JulianDate.universal_time(self.to_f * When::TM::IntervalLength::SECOND, options)
end

#tm_pos(options = {}) ⇒ When::TM::DateAndTime Also known as: to_tm_pos

Note:

core/extension

対応する When::TM::DateAndTime を生成

Parameters:

  • options (Hash) (defaults to: {})

    暦法や時法などの指定

Returns:

See Also:



46
47
48
# File 'lib/when_exe/core/extension.rb', line 46

def tm_pos(options={})
  When.at(self, options)
end