Skip to content

gandarez/go-olson-timezone

Repository files navigation

go-olson-timezone

Tests codecov Go Reference

A Golang library that tries to figure out your local timezone.

This lib has been ported from tzlocal with some improvements for Go.

Installation

go get -u github.com/gandarez/go-olson-timezone

Features

  • Always try to parse TZ environment variable if present.
  • For Unix based systems (including macOS), timezone may be parsed from:
    • /etc/timezone
    • /var/db/zoneinfo
    • /etc/sysconfig/clock
    • /etc/conf.d/clock
    • /etc/localtime
  • For windows, timezone will be discovered at registry key SYSTEM\CurrentControlSet\Control\TimeZoneInformation.