A Golang library that tries to figure out your local timezone.
This lib has been ported from tzlocal with some improvements for Go.
go get -u github.com/gandarez/go-olson-timezone
- 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
.