Calculating Islamic prayer times can be simple, if you are outside and have stick (where you can check if its sunrise, sunset, mid-day etc.) or quite complex if you want to calculate whether it’s sunrise, sunset, mid-day etc. Thankfully, there are people who have done the complex calculations and others that have pulled these into software.

Unfortunately however, the geniuses at decided to use c as their preferred language for the iTools project. iTools is available as a package on Ubuntu, as well as libitl, the library where all the smart stuff happens. The guys at arabeyes were kind enough to also include with the libitl source code an example perl wrapper and the SWIG configuration files thereof!

A few hours of tinkering with SWIG got me to the point where I can succesfully calculate Salaah times using a decent programming language (Python).

Here is the wrapper library, compiled object and example code for anyone that wants it. I will explain the process in making the attached when I have more time (InshaAllah).

For anyone wishing to roll their own, download the SWIG interface file and Makefile and place these in the swig folder of the libitl source package. Build the itl source before running “make python” in the swig directory.

0 thoughts on “iTools in Python

Leave a Reply