Zoltan Gyarmati authored on 24 Aug 2016
data properly install data and config files 1 year ago
man add gettz utility man page generation, fix (well, hack) paralel build of man/pdf files 1 year ago
src gettz: add system tz setting calls, make independent from configuration 1 year ago
.gitignore add gpsd connection and action command execution 1 year ago
LICENSE add license files and headers 1 year ago
Makefile.am properly install data and config files 1 year ago
README.md readme.. 1 year ago
autogen.sh inital dir structure and source files 1 year ago
configure.ac hunting down some warnings 1 year ago
ogrinfo.sh inital version with experimenting tz id lookup logic 1 year ago
timezoned.ini gettz: add system tz setting calls, make independent from configuration 1 year ago
README.md

Timezoned

The timezoned package contains a daemon (timezoned) which connects to GPSd, regularly requests the current position of the system, and based on the GPS coordinates looks up the timezone assigned to the current location (using the TZ shapefiles created by Eric Muller) and sets the system's timezone accordingly. The goal is to always set the current timezone on ever-moving embededd systems (like digital signage systems on vehicles), so they can always display the correct local time. The package also contains a command line utility which accepts coordinates as command line arguments, looks up and prints the corresponding timezone name, and optionally sets the system's timezone to it.

Building

Timezoned has 2 mandatory and 1 optional dependencies: shapelib, libgps, and optionally (if the system uses systemd and systemd-timedated) libdbus, and obviosly running systemd-timedated as runtime dependency.

To check out the code and compile on a recent Debian based system:

# get dependencies:
apt-get install libdbus-1-dev libshp-dev libgps-dev
# get the source
git clone https://github.com/zgyarmati/timezoned.git
cd timezoned
# create configure and co. not needed when building from release tarball
# but needed when checked out from git
./autogen.sh
# to disable dbus (and in turn systemd), just don't add '-enable-systemd'
./configure  -enable-systemd --enable-silent-rules --prefix=/usr
make
# if you also want to install it:
sudo make install
#running gettz from the source dir:
GETTZ_SHP_FILE="data/tz_world/tz_world.shp" GETTZ_DBF_FILE="data/tz_world/tz_world.dbf" ./src/gettz 20.3821615  47.891469167
# ^ should yield Europe/Budapest

Bookmarks

http://stackoverflow.com/questions/5584602/determine-timezone-from-latitude-longitude-without-using-web-services-like-geona

http://redwarrior.org/blog/?p=16