| Module | XSD::XSDDateTimeImpl |
| In: |
xsd/datatypes.rb
|
| SecInDay | = | 86400 |
# File xsd/datatypes.rb, line 522 def of2tz(offset) diffmin = offset * 24 * 60 if diffmin.zero? 'Z' else ((diffmin < 0) ? '-' : '+') << format('%02d:%02d', (diffmin.abs / 60.0).to_i, (diffmin.abs % 60.0).to_i) end end
# File xsd/datatypes.rb, line 532 def screen_data(t) if (t.is_a?(Date)) t elsif (t.is_a?(Time)) sec, min, hour, mday, month, year = t.to_a[0..5] diffday = t.usec.to_r / 1000000 / SecInDay of = t.utc_offset.to_r / SecInDay data = DateTime.civil(year, month, mday, hour, min, sec, of) data += diffday data else screen_data_str(t) end end
# File xsd/datatypes.rb, line 489 def to_time begin if @data.offset * SecInDay == Time.now.utc_offset d = @data usec = (d.sec_fraction * SecInDay * 1000000).round Time.local(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec) else d = @data.newof usec = (d.sec_fraction * SecInDay * 1000000).round Time.gm(d.year, d.month, d.mday, d.hour, d.min, d.sec, usec) end rescue ArgumentError nil end end