#dbus #systemd #timezone #geoclue #zoneinfo

app automatic-timezoned

Automatically update system timezone based on location

6 stable releases

Uses new Rust 2021

new 1.0.5 Aug 12, 2022
1.0.4 Jul 30, 2022
1.0.3 Jul 25, 2022
1.0.2 Jul 24, 2022
1.0.0 Jul 23, 2022

#52 in Unix APIs

Download history 6/week @ 2022-07-17 97/week @ 2022-07-24 22/week @ 2022-07-31 29/week @ 2022-08-07

154 downloads per month

GPL-3.0 license

49KB
239 lines

Automatic Timezone Daemon

Crates.io Build Status dependency status

A Linux daemon to automatically update the system timezone based on location.

How It Works

  1. The list of timezones and their location is loaded from the zone1970.tab file
  2. The current location is retrieved from GeoClue
  3. The distance between the current location and each timezone is calculated with the Haversine formula
  4. The shortest distance determines the current timezone set via systemd-timedated
  5. Then, the daemon waits for the location updated signal from GeoClue, and repeats from step 2 when it happens

Note: The timezone choice may not be accurate if a reference city in a neighboring timezone is closer than any one in the actual timezone.

Requirements

Please see the examples/ directory for sample configurations.

Sample Nix modules can be found here (may be submitted to NixOS/nixpkgs if there is interest):

Configuration

Please see:

automatic-timezoned --help

Development

Build

cargo build --release

Test

cargo test

Alternatives

This service depends on the tzdata package which allows to update the Time Zone Database independently and does not depend on a third-party service to calculate distances, here are some alternatives which have made different trade-offs for performance and accuracy:

License

GNU General Public License v3.0

Dependencies

~12–19MB
~351K SLoC