Skip to content

rubin55/ll2tz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ll2tz - Latitude and Longitude to Time Zone

A very simple Python script that utilizes Geoclue through PYGobject with timezonefinder to obtain a timezone string which could be used to assist with dynamically setting /etc/localtime.

venv --system-site-packages .venv
. .venv/bin/activate
pip install -r requirements.txt
python ll2tz.py

After you've created a venv with the necessary dependencies, you can execute through ll2tz.sh from anywhere, without the need to activate the virtual environement first.

You could set /etc/localtime like this:

sudo ln -sf /usr/share/zoneinfo/$(l22tz.sh) /etc/localtime

In fact, I've made a helper script that can be used in combination with NetworkManager-dispatch. Place ll2tz-setter.sh in:

/etc/NetworkManager/dispatch.d

Make sure the script is executable and owned by root. The script will trigger when a network interface goes up. You can see what it did by looking at /tmp/ll2tz-setter.out.

Todo

  • Make pip-installable (upload to pip)
  • Optional: make package for void linux

About

Latitude and Longitude to Time Zone command-line utility

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published