class M2TSParser::Appendix::AribTime
Public Instance Methods
content_description()
click to toggle source
# File lib/m2ts_parser/appendix/arib_time.rb, line 41 def content_description to_s end
convert_mjd_to_date(mjd)
click to toggle source
ARIB STD-B10 2, appendix-C
# File lib/m2ts_parser/appendix/arib_time.rb, line 19 def convert_mjd_to_date(mjd) y_ = ((mjd - 15078.2) / 365.25).to_i m_ = ((mjd - 14956.1 - (y_ * 365.25).to_i) / 30.6001).to_i d = mjd - 14956 - (y_ * 365.25).to_i - (m_ * 30.6001).to_i k = (m_ == 14 || m_ == 15) ? 1 : 0 y = y_ + k m = m_ - 1 - k * 12 return Date.new(1900 + y, m, d) end
date()
click to toggle source
# File lib/m2ts_parser/appendix/arib_time.rb, line 14 def date return @date ||= convert_mjd_to_date(mjd.to_i) end
date_str()
click to toggle source
# File lib/m2ts_parser/appendix/arib_time.rb, line 29 def date_str return sprintf("%02d/%02d/%02d", date.year, date.month, date.day) end
to_s()
click to toggle source
# File lib/m2ts_parser/appendix/arib_time.rb, line 33 def to_s return sprintf("%s %02d:%02d:%02d +0900", date_str, hour.to_i, min.to_i, sec.to_i) end
to_time()
click to toggle source
# File lib/m2ts_parser/appendix/arib_time.rb, line 37 def to_time return Time.parse(to_s) end