from_seconds : I32 -> FixedOffset
Construct an explicit local-minus-POSIX offset in whole seconds. Positive offsets place the local label ahead of the POSIX label. All I32 values are accepted; a text format may impose a narrower range.
FixedOffset :: # (opaque)
Explicit local-minus-POSIX offset in whole seconds. No named-zone rules.
Example
Offsets are local minus timeline, in whole seconds. A fixed offset does not
model daylight-saving transitions; use ZoneRules for named zones.
import time.FixedOffset
import time.PosixBoundary
import time.LocalDateTime
import time.ClockTime
expect {
local = FixedOffset.project(
FixedOffset.from_seconds(3600),
PosixBoundary.from_microseconds(0), Gregorian,
)?
ClockTime.to_fields(LocalDateTime.clock(local)).hour == 1
}
Examples assume a package dependency named time.
from_seconds : I32 -> FixedOffset
Construct an explicit local-minus-POSIX offset in whole seconds. Positive offsets place the local label ahead of the POSIX label. All I32 values are accepted; a text format may impose a narrower range.
to_seconds : FixedOffset -> I32
Read the whole-second local-minus-POSIX offset.
Interpret a local date-time using this fixed offset. Return OutOfRange if the resulting position cannot fit I64 microseconds. There are no gap or fold choices because the offset is constant.
Express a POSIX position as a local date-time in the requested calendar under this offset. Return OutOfRange if the local date is unsupported; no named-zone lookup or calendar substitution is performed.
Compare offset seconds. Equal fixed offsets do not imply equal named zones.
Hash the offset seconds consistently with equality for dictionary/set keys.
to_inspect : FixedOffset -> Str
Describe the offset in seconds with its local-minus-POSIX convention. This diagnostic string is not an interchange timestamp.