shigoto_tz (shigoto v1.9.10)

View Source

Resolves IANA named time zones (e.g. <<"Europe/Stockholm">>) to their UTC offset at a specific instant, accounting for daylight saving time.

Reads the operating system's IANA time zone database directly (TZif files, RFC 8536) from $TZDIR or /usr/share/zoneinfo. There is no external dependency and no build step: the database is kept current by the OS.

Offsets are resolved from the file's explicit transition table. For instants beyond the last recorded transition, the trailing POSIX TZ rule is evaluated so future dates stay correct.

Summary

Functions

UTC offset in seconds for Zone at the given UTC datetime, e.g. {ok, 7200} for <<"Europe/Stockholm">> during summer time.

Functions

offset(Zone, UtcDatetime)

-spec offset(binary(), calendar:datetime()) -> {ok, integer()} | {error, term()}.

UTC offset in seconds for Zone at the given UTC datetime, e.g. {ok, 7200} for <<"Europe/Stockholm">> during summer time.