Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxbrunet/automatic-timezoned
A Linux daemon to automatically update the system timezone based on location
https://github.com/maxbrunet/automatic-timezoned
dbus geoclue systemd timezone zoneinfo
Last synced: 6 days ago
JSON representation
A Linux daemon to automatically update the system timezone based on location
- Host: GitHub
- URL: https://github.com/maxbrunet/automatic-timezoned
- Owner: maxbrunet
- License: gpl-3.0
- Created: 2022-07-22T02:06:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T16:37:28.000Z (14 days ago)
- Last Synced: 2024-10-23T23:13:59.559Z (14 days ago)
- Topics: dbus, geoclue, systemd, timezone, zoneinfo
- Language: Rust
- Homepage:
- Size: 836 KB
- Stars: 20
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Automatic Timezone Daemon
[![Crates.io](https://img.shields.io/crates/v/automatic-timezoned)](https://crates.io/crates/automatic-timezoned)
[![Build Status](https://github.com/maxbrunet/automatic-timezoned/actions/workflows/build.yml/badge.svg)](https://github.com/maxbrunet/automatic-timezoned/actions/workflows/build.yml)
[![dependency status](https://deps.rs/repo/github/maxbrunet/automatic-timezoned/status.svg)](https://deps.rs/repo/github/maxbrunet/automatic-timezoned)A Linux daemon to automatically update the system timezone based on location.
## How It Works
1. The current location is retrieved from GeoClue
2. The timezone of the current location is determined using [tzf-rs](https://crates.io/crates/tzf-rs)
3. The timezone is updated via `systemd-timedated`
4. Then, the daemon waits for the location updated signal from GeoClue, and repeats from step 1 when it happens_Note: The timezone choice may not be accurate if very close to a timezone border due to `tzf-rs` using simplified shape data._
## Requirements
* [GeoClue](https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home)
* [systemd](https://systemd.io/)
* The user must be allowed to use the [`org.freedesktop.timedate1.set-timezone` action](https://www.freedesktop.org/software/systemd/man/org.freedesktop.timedate1.html#Security) (`root` or [Polkit](https://www.freedesktop.org/software/polkit/docs/latest/) rule)
* The user must have a running GeoClue agent or the GeoClue configuration must allow the absence of agent with an empty agent `whitelist`
(see also [Stebalien/localtime - Configuring GeoClue](https://github.com/Stebalien/localtime#configuring-geoclue), [geoclue/geoclue#74](https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/74))Please see the [examples/](examples/) directory for sample configurations.
## Configuration
```
$ automatic-timezoned --help
Automatically update system timezone based on locationUsage: automatic-timezoned [OPTIONS]
Options:
-l, --log-level Log level filter. See for syntax [env: AUTOTZD_LOG_LEVEL=] [default: info]
-h, --help Print help
-V, --version Print version```
## Packages
[![Packaging status](https://repology.org/badge/vertical-allrepos/automatic-timezoned.svg?header=&columns=3)](https://repology.org/project/automatic-timezoned/versions)
## Development
### Build
```shell
cargo build --release
```### Test
```shell
cargo test
```## Alternatives
This service depends on the `tzf-rs` package which bundles timezones and their geographical borders,
here are some alternatives which have made different trade-offs for performance and accuracy:* [github.com/Stebalien/localtime](https://github.com/Stebalien/localtime): Depends on the unmaintained [github.com/bradfitz/latlong](https://pkg.go.dev/github.com/bradfitz/latlong) Go library (although if you prefer Go, [github.com/ringsaturn/tzf](https://pkg.go.dev/github.com/ringsaturn/tzf) could be used).
* [Gnome Automatic Time Zone](https://help.gnome.org/users/gnome-help/stable/clock-timezone.html.en) ([Source Code](https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/tree/master/plugins/datetime)): Depends on the `tzdata` package and [Nominatim Web API](https://nominatim.org/) for distances.## License
GNU General Public License v3.0