class ICU::UniversalTimeScale
- ICU::UniversalTimeScale
- Reference
- Object
Overview
Universal Time Scale Convert dates between binary datetime conventions
Usage
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:
icu/universal_time_scale.crConstant 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[:{{ name.id }}] = begin ustatus = LibICU::UErrorCode::UZeroError value = LibICU.utmscale_get_time_scale_value(time_scale, {{ id.id }}, 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
-
.from(time : Int64, time_scale : DateTimeScale) : UniversalTime
Converts a time using the timescale_ date convention to a Universal time
-
.to(universal_time : UniversalTime, time_scale : DateTimeScale) : Int64
Converts a UniversalTime to a time using the timescale_ date convention
Class Method Detail
Converts a time using the timescale_ date convention to a Universal time
Converts a UniversalTime to a time using the timescale_ date convention