Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-31T23:01:11.000Z (about 3 years ago)
- Last Synced: 2024-10-13T01:36:35.767Z (3 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
[![Tests](https://img.shields.io/github/workflow/status/gandarez/go-olson-timezone/Tests/master?label=tests)](https://github.com/gandarez/go-olson-timezone/actions)
[![codecov](https://codecov.io/gh/gandarez/go-olson-timezone/branch/master/graph/badge.svg?token=ATAVS1K1CV)](https://codecov.io/gh/gandarez/go-olson-timezone)
[![Go Reference](https://pkg.go.dev/badge/github.com/gandarez/go-olson-timezone.svg)](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`.