walkzzz/chrono_tz-mbt/core does not have a README file

    FixedTimespan

    pub(all) struct FixedTimespan {
    offset : Int
    name : String
    } derive(Compare, Eq,
    Debug
    )

    单段固定偏移:从某过渡点起生效的 UTC 偏移(秒)及其缩写名。

    FixedTimespan::compare

    FixedTimespan::equal

    FixedTimespan::not_equal

    fn FixedTimespan::not_equal(x : FixedTimespan, y : FixedTimespan) -> Bool

    FixedTimespan::op_ge

    fn FixedTimespan::op_ge(x : FixedTimespan, y : FixedTimespan) -> Bool

    FixedTimespan::op_gt

    fn FixedTimespan::op_gt(x : FixedTimespan, y : FixedTimespan) -> Bool

    FixedTimespan::op_le

    fn FixedTimespan::op_le(x : FixedTimespan, y : FixedTimespan) -> Bool

    FixedTimespan::op_lt

    fn FixedTimespan::op_lt(x : FixedTimespan, y : FixedTimespan) -> Bool

    FixedTimespanSet

    pub struct FixedTimespanSet {
    first_offset_idx : Int
    first_abbr_idx : Int
    rest_compact : Array[(Int64, Int, Int)]
    } derive(Compare, Eq,
    Debug
    )

    单个时区的预计算过渡表,由 IANA tzdata 离线生成,零运行期解析。 rest_compact 每条为 (transitionUtcSec, offsetIdx, abbrIdx)。

    FixedTimespanSet::compare

    FixedTimespanSet::equal

    FixedTimespanSet::estimated_memory_bytes

    fn FixedTimespanSet::estimated_memory_bytes(self : FixedTimespanSet) -> Int64

    返回压缩存储的内存估算(字节)。

    FixedTimespanSet::from_first_rest

    fn FixedTimespanSet::from_first_rest(first : FixedTimespan, rest : Array[(Int64, FixedTimespan)]) -> FixedTimespanSet

    由最早段与后续段数组构造(兼容 API,内部转换为索引)。

    FixedTimespanSet::get

    fn FixedTimespanSet::get(self : FixedTimespanSet, index : Int) -> FixedTimespan

    返回第 index 段的 FixedTimespan(查表还原)。

    FixedTimespanSet::len

    fn FixedTimespanSet::len(self : FixedTimespanSet) -> Int

    返回段总数(1 + rest_compact.length)。

    FixedTimespanSet::local_span

    fn FixedTimespanSet::local_span(self : FixedTimespanSet, index : Int) -> Span

    返回第 index 段的本地时间戳区间(左闭右开,可能产生缺口/歧义)。

    FixedTimespanSet::make

    fn FixedTimespanSet::make(first_offset_idx : Int, first_abbr_idx : Int, rest_compact : Array[(Int64, Int, Int)]) -> FixedTimespanSet

    由压缩索引直接构造(数据文件用,零转换开销)。

    FixedTimespanSet::name_at

    fn FixedTimespanSet::name_at(self : FixedTimespanSet, index : Int) -> String

    返回第 index 段的缩写名(直接查表)。

    FixedTimespanSet::not_equal

    fn FixedTimespanSet::not_equal(x : FixedTimespanSet, y : FixedTimespanSet) -> Bool

    FixedTimespanSet::offset_at

    fn FixedTimespanSet::offset_at(self : FixedTimespanSet, index : Int) -> Int

    返回第 index 段的 offset 秒数(直接查表)。

    FixedTimespanSet::op_ge

    FixedTimespanSet::op_gt

    FixedTimespanSet::op_le

    FixedTimespanSet::op_lt

    FixedTimespanSet::utc_span

    fn FixedTimespanSet::utc_span(self : FixedTimespanSet, index : Int) -> Span

    返回第 index 段的 UTC 时间戳区间(左闭右开,无歧义)。

    Ordering

    pub(all) enum Ordering {
    Less
    Equal
    Greater
    } derive(Compare, Eq,
    Debug
    )

    三路比较结果:Less / Equal / Greater。

    MoonBit 标准库未提供此枚举(其 Compare trait 的 compare 方法返回 Int32 的负/零/正),本项目为 DST 三分支判断的类型安全与可读性自定义。 序关系按声明顺序:Less < Equal < Greater。

    Ordering::compare

    fn Ordering::compare(Ordering, Ordering) -> Int

    Ordering::equal

    fn Ordering::equal(Ordering, Ordering) -> Bool

    Ordering::not_equal

    fn Ordering::not_equal(x : Ordering, y : Ordering) -> Bool

    Ordering::op_ge

    fn Ordering::op_ge(x : Ordering, y : Ordering) -> Bool

    Ordering::op_gt

    fn Ordering::op_gt(x : Ordering, y : Ordering) -> Bool

    Ordering::op_le

    fn Ordering::op_le(x : Ordering, y : Ordering) -> Bool

    Ordering::op_lt

    fn Ordering::op_lt(x : Ordering, y : Ordering) -> Bool

    Ordering::to_repr

    Span

    pub(all) struct Span {
    begin : Int64?
    end : Int64?
    } derive(Compare, Eq,
    Debug
    )

    左闭右开的时间戳区间 [begin, end),begin/end 为 None 表示无界。

    Span::cmp

    fn Span::cmp(self : Span, x : Int64) -> Ordering

    返回 x 相对本区间的序:x 在区间内 Equal,x 早于区间 Greater,x 晚于区间 Less。

    Span::compare

    fn Span::compare(Span, Span) -> Int

    Span::contains

    fn Span::contains(self : Span, x : Int64) -> Bool

    判断 x 是否落在 [begin, end) 内(含无界语义)。

    Span::equal

    fn Span::equal(Span, Span) -> Bool

    Span::not_equal

    fn Span::not_equal(x : Span, y : Span) -> Bool

    Span::op_ge

    fn Span::op_ge(x : Span, y : Span) -> Bool

    Span::op_gt

    fn Span::op_gt(x : Span, y : Span) -> Bool

    Span::op_le

    fn Span::op_le(x : Span, y : Span) -> Bool

    Span::op_lt

    fn Span::op_lt(x : Span, y : Span) -> Bool

    Span::to_repr

    IANA_TZDB_VERSION

    let IANA_TZDB_VERSION : String

    IANA tzdb 版本号。

    civil_from_days

    fn civil_from_days(days : Int64) -> (Int64, Int64, Int64)

    将自 1970-01-01 起的天数转换为公历日期。
    • days: 天数(可为负) 返回:(year, month, day)

    days_from_civil

    fn days_from_civil(year : Int64, month : Int64, day : Int64) -> Int64

    将公历日期转换为自 1970-01-01 起的天数。
    • year: 年(可为负,表示公元前)
    • month: 月 [1, 12]
    • day: 日 [1, 31] 返回:天数(1970-01-01 → 0)

    tz_name_table

    let tz_name_table : Array[String]

    全局时区缩写查表(178 个唯一值,字典序排列)。

    tz_offset_table

    let tz_offset_table : Array[Int]

    全局 UTC 偏移查表(406 个唯一值,升序排列)。