https://github.com/gandarez/go-olson-timezone
A Golang library that tries to figure out your local timezone
https://github.com/gandarez/go-olson-timezone
go golang iana olson time timezone tzlocal
Last synced: 4 months ago
JSON representation
A Golang library that tries to figure out your local timezone
- Host: GitHub
- URL: https://github.com/gandarez/go-olson-timezone
- Owner: gandarez
- License: bsd-3-clause
- Created: 2021-12-29T13:16:18.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-31T23:01:11.000Z (over 3 years ago)
- Last Synced: 2025-01-17T14:39:10.144Z (6 months ago)
- Topics: go, golang, iana, olson, time, timezone, tzlocal
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-olson-timezone
[](https://github.com/gandarez/go-olson-timezone/actions)
[](https://codecov.io/gh/gandarez/go-olson-timezone)
[](https://pkg.go.dev/github.com/gandarez/go-olson-timezone)A Golang library that tries to figure out your local timezone.
> This lib has been ported from [tzlocal](https://github.com/regebro/tzlocal) with some improvements for Go.
## Installation
```bash
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`.