class ICU::UniversalTimeScale


Universal Time Scale Convert dates between binary datetime conventions


ts = ICU::UniversalTimeScale::DateTimeScale::UnixTime
ICU::UniversalTimeScale.from(0.to_i64, ts) # => (ICU::UniversalTimeScale::TIME_SCALES[ts][:epoch_offset] * (10**7))

See also

Defined in:


Constant Summary

TIME_SCALE_VALUES_IDS = {precision: LibICU::UTimeScaleValue::UnitsValue, epoch_offset: LibICU::UTimeScaleValue::EpochOffsetValue, from_min: LibICU::UTimeScaleValue::FromMinValue, from_max: LibICU::UTimeScaleValue::FromMaxValue, to_min: LibICU::UTimeScaleValue::ToMinValue, to_max: LibICU::UTimeScaleValue::ToMaxValue}
TIME_SCALES = begin tss = Hash(DateTimeScale, TimeScaleValues).new LibICU::UDateTimeScale.each do |time_scale, _| if time_scale == LibICU::UDateTimeScale::MaxScale next end tsv = Hash(Symbol, Int64).new {% for name, id in TIME_SCALE_VALUES_IDS %} tsv[:{{ }}] = begin ustatus = LibICU::UErrorCode::UZeroError value = LibICU.utmscale_get_time_scale_value(time_scale, {{ }}, pointerof(ustatus)) ICU.check_error!(ustatus) value end {% end %} tss[time_scale] = TimeScaleValues.from(tsv) end tss end

A list of the supported time scales

Class Method Summary

Class Method Detail

def self.from(time : Int64, time_scale : DateTimeScale) : UniversalTime #

Converts a time using the timescale_ date convention to a Universal time

[View source]
def : UniversalTime, time_scale : DateTimeScale) : Int64 #

Converts a UniversalTime to a time using the timescale_ date convention

[View source]