glzoneinfo

Parse the Time Zone Information Format (TZif) described in RFC 8536 At the moment it supports versions 1 and 2. Version 3 files will be parsed, but include only information up to V2.

Types

pub type Date {
  Date(month: Int, week: Int, day: Int)
}

Constructors

  • Date(month: Int, week: Int, day: Int)
pub type Errors {
  InvalidZoneName
  ParseError(String, BitArray)
}

Constructors

  • InvalidZoneName
  • ParseError(String, BitArray)
pub type Header {
  Header(
    utc_count: Int,
    wall_count: Int,
    leap_count: Int,
    transition_count: Int,
    type_count: Int,
    abbrev_length: Int,
  )
}

Constructors

  • Header(
      utc_count: Int,
      wall_count: Int,
      leap_count: Int,
      transition_count: Int,
      type_count: Int,
      abbrev_length: Int,
    )
pub type LeapSecond {
  LeapSecond(epoch: Int, correction: Int)
}

Constructors

  • LeapSecond(epoch: Int, correction: Int)
pub type Rule {
  Rule(
    std_abbr: option.Option(String),
    std_offset: Int,
    dst_abbr: option.Option(String),
    dst_offset: Int,
    start_time: option.Option(Date),
    end_time: option.Option(Date),
  )
}

Constructors

  • Rule(
      std_abbr: option.Option(String),
      std_offset: Int,
      dst_abbr: option.Option(String),
      dst_offset: Int,
      start_time: option.Option(Date),
      end_time: option.Option(Date),
    )
pub type Time {
  Time(hours: Int, minutes: Int, seconds: Int)
}

Constructors

  • Time(hours: Int, minutes: Int, seconds: Int)
pub type TransitionInfo {
  TransitionInfo(
    gmt_offset: Int,
    starts_at: Int,
    is_dst: Bool,
    abbrev_index: Int,
    abbreviation: String,
    is_std: Bool,
    is_utc: Bool,
  )
}

Constructors

  • TransitionInfo(
      gmt_offset: Int,
      starts_at: Int,
      is_dst: Bool,
      abbrev_index: Int,
      abbreviation: String,
      is_std: Bool,
      is_utc: Bool,
    )
pub type Version {
  V1
  V2
  V3
}

Constructors

  • V1
  • V2
  • V3
pub type Zone {
  Zone(
    version: Version,
    transitions: List(TransitionInfo),
    leaps: List(LeapSecond),
    rule: option.Option(Rule),
  )
}

Constructors

  • Zone(
      version: Version,
      transitions: List(TransitionInfo),
      leaps: List(LeapSecond),
      rule: option.Option(Rule),
    )

Functions

pub fn parse(binary: BitArray) -> Result(Zone, Errors)
Search Document