Class Index [+]

Quicksearch

When::TM::ClockTime

時刻

see gml schema

Attributes

clk_time[R]

時刻要素

  type : [Numeric]

Public Class Methods

new(time, options={}) click to toggle source

オブジェクトの生成

  time : String or [Numeric]
    時刻表現

  options        : Hash
    :frame     => When::TM::Clock
    :precision => Integer (Enumerated in the When::Coordinates Module)
      # File when/tmposition.rb, line 1097
1097:     def initialize(time, options={})
1098:       # 参照系の取得
1099:       @frame = (options[:frame] || Clock.local_time || When.utc)
1100:       @frame = When.Clock(@frame) if (@frame.kind_of?(String))
1101:       options.delete(:frame)
1102: 
1103:       # 時刻表現の解読 ( Time Zone の解釈 )
1104:       if (time.kind_of?(String))
1105:         case time
1106:         when /^([-+])?(\d{2,}?):?(\d{2})?:?(\d{2}(\.\d+)?)?$/
1107:           sign, hh, mm, ss = $~[1..4]
1108:           time = @frame._validate([0,0,0,0],
1109:                  [0,
1110:                   -(sign.to_s + "0" + hh.to_s).to_i,
1111:                   -(sign.to_s + "0" + mm.to_s).to_i,
1112:                   Pair._en_number(-(sign.to_s + "0" + ss.to_s).to_f)])
1113:           time[0] = Pair.new(0, time[0].to_i) if (time[0] != 0)
1114:         when /^Z$/
1115:           time = [0,0,0,0]
1116:         else
1117:           raise ArgumentError, "Invalid Time Format"
1118:         end
1119:       end
1120:       @clk_time = time
1121: 
1122:       # 分解能
1123:       @precision = @frame._precision(time, options.delete(:precision))
1124: 
1125:       super(options)
1126:     end

Public Instance Methods

carry() click to toggle source

繰り上がり

  returns : Numeric

  日付の境界が午前0時でない場合、clk_time の最上位桁に 0 以外が入ることがある
     # File when/tmposition.rb, line 967
967:     def carry
968:       return @clk_time[0]
969:     end
name(index, format=nil) click to toggle source

要素の多言語対応文字列化

  index   : Integer or String of When::Coordinates::PRECISION
    多言語対応文字列化する要素の指定

  format  : When::BasicTypes::M17n
    多言語対応文字列化の書式

  returns : When::BasicTypes::M17n
      # File when/tmposition.rb, line 992
 992:     def name(index, format=nil)
 993:       digit      = _digit(index) {|digit| digit > DAY}
 994:       coordinate = @clk_time[digit]
 995:       return m17n(format % coordinate) if format
 996: 
 997:       indices  = @frame.indices[digit-1]
 998:       if indices
 999:         trunk  = indices.trunk
1000:         branch = indices.branch
1001:       end
1002:       format = branch ? "%02d:" : "%02d"
1003:       return m17n(format % coordinate) unless trunk
1004:       trunk  = trunk[coordinate * 1]
1005:       return m17n(trunk) unless branch
1006:       return trunk.prefix(branch[coordinate * 0])
1007:     end
to_m17n(precision=@precision) click to toggle source

多言語対応文字列化

  precision : Integer (Enumerated in the When::Coordinates Module)
    どの桁まで多言語対応文字列化するか、分解能で指定する(デフォルト : @precision)

  returns   : When::BasicTypes::M17n

  When Standard Representation により多言語対応文字列化する
      # File when/tmposition.rb, line 1018
1018:     def to_m17n(precision=@precision)
1019:       time  = m17n('T' + _time_to_s(precision))
1020:       time += @frame.zone if (@frame && !@frame.equal?(Clock.local_time))
1021:       return time
1022:     end
to_s(precision=@precision) click to toggle source

文字列化

  precision : Integer (Enumerated in the When::Coordinates Module)
    どの桁まで文字列化するか、分解能で指定する(デフォルト : @precision)

  returns   : String

  When Standard Representation により文字列化する
      # File when/tmposition.rb, line 1033
1033:     def to_s(precision=@precision)
1034:       time  = 'T' + _time_to_s(precision)
1035:       time += @frame.zone if (@frame && !@frame.equal?(Clock.local_time))
1036:       return time
1037:     end
universal_time() click to toggle source

内部時間

  returns : Numeric

  T00:00:00Z からの Universal Coordinated Time の経過時間 / 128秒

  時法によっては、異なる意味を持つことがある
     # File when/tmposition.rb, line 956
956:     def universal_time
957:       raise NameError, "Temporal Reference System is not defined" unless @frame
958:       @universal_time ||= @frame.to_universal_time(@clk_time)
959:     end
value(index) click to toggle source

要素の参照

  index   : Integer or String of When::Coordinates::PRECISION
    参照する要素の指定

  returns : Numeric
     # File when/tmposition.rb, line 978
978:     def value(index)
979:       @clk_time[_digit(index) {|digit| digit >= DAY}]
980:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.