def tzif.block

bend-kit-time@0.3.0.0 · time.bend:683

import bend-kit-time@0.3.0.0/time.bend as Time
import Base

683# h starts at a header; its data block follows it. Version 2+ blocks have 8-byte times and a footer.
684def tzif.block(+t8: Bool, +h: String) -> Maybe<&2, Zone>:
685  +d = String.drop(h, 44n)
686  +tc = tzif.count(h, 3n)
687  +ty = tzif.count(h, 4n)
688  +at = (tc * tzif.size(t8) + tc : Nat)
689  +foot = String.drop(d, tzif.bsize(t8, h))
690  tzif.if(Bool.and(String.starts_with(h, "TZif"), Bool.and(Nat.is_gt(ty, 0n),
691      Nat.is_le((44n + tzif.bsize(t8, h) : Nat), String.length(h)))),
692    Zone{tzif.trans(tc, t8, d, String.drop(d, (tc * tzif.size(t8) : Nat))),
693      tzif.types(ty, String.drop(d, at), String.take(String.drop(d, (at + ty * 6n : Nat)), tzif.count(h, 5n))),
694      Bool.pick(String, t8, name(String.split(foot, '\n'), 1), "")})

Uses (24)

Used by (1)