GithubHelp home page GithubHelp logo

gregoriomezquita / tzposix Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.05 MB

Get the timezone posix string from GPS coordinates

C 96.10% Makefile 3.90%
microcontroller timezone c posix gps-coordinates conversion cgi-bin

tzposix's Introduction

tzposix

Get the timezone posix string from GPS coordinates

The software of some microcontrollers follows the POSIX standard of local time setting. This means that you must set the environment variable โ€œTZโ€ with setenv and then call tzset in time library.

tzposix.c is a CGI to convert geographic location (lat, long) into the necessary POSIX string for the TZ environment variable. It returns a json containing the timezone Olson and POSIX version given certain GPS coordinates. Once compiled and downloaded in the cgi-bin directory of your web server it is invoked as follows:

https://yourserver/cgi-bin/tzposix?lat=[float]&lon=[float]
Example:
https://sotech.es/cgi-bin/tzposix?lat=40.4165000&lon=-3.7025600

returns the following JSON:

{"olson": "Europe/Madrid", "posix": "CET-1CEST,M3.5.0,M10.5.0/3"}

Source code is inspired by the work of Bertold Van den Bergh. Contains instructions for the generation of the timezone geographic databases (timezone16.bin y timezone21.bin) en Database Generation.

Timezone Boundary Builder is the basis for generating the databases. You can also find software for several languages (C, Javascript, Python, PHP, etc).

File tzinfo.json contains the correspondence table between the Olson format and the POSIX format. Instructions for creating it are in tzinfo.

Update

Each time the TimeZone DataBase is changed, files timezone16.bin o timezone21.bin as well as tzinfo.json must be updated. You can subscribe to the mailing list where updates are announced.

tzposix's People

Contributors

gregoriomezquita avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.