#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'ITimer21/README' <<'END_OF_FILE' X X X ___ | | | ___ | | /| | | | | X | | _| | | | | _| | /_| | | | | | | | X o_|__|____| | | | o | o____| | | |__|__| | o_|__|__|___| X ___/ oo ___| |___| ___| ___/ o X X X XIslamicTimer is a software package consisting of programs for generating XIslamic Calendars, translating Gregorian/Julian dates to/from dates in Xthe Islamic Calendar, computing prayer time schedules, and for determining Xthe direction of the Qiblah. It also includes a prayers time reminder/ Xnotification service. X XThis is release 2.1 of IslamicTimer. It includes the following: X X README - this file. X X hdate - a directory containing the source, documentation, X background information, and makefile for HDATE and X HCAL. HDATE prints the current Islamic (Hijri) date X and translates dates between the Hijri calendar and the X Gregorian/Julian Calendar. HCAL prints calendars X (for a Hijri/Gregorian month or an entire year) with X both common and Hijri dates. X X praytime - a directory containing the source, documentation, and X makefile for PRAYTIME, a program that generates X Islamic prayer time schedules and computes the X direction of the Qiblah for any location. X The schedules can be generated for both Hijri or X Gregorian months or years. X X premind - a directory containing the source, documentation, and X makefile for PREMIND, a program that works in conjunction X with PRAYTIME and provides prayers time notification/ X reminder service. (premind works on UNIX platforms only.) X XThe software should be fairly portable and it should run on both UNIX Xand DOS platforms (DOS executables are included in the DOS distribution). XIf you have to make any changes to files other than the Makefiles to make Xthese programs work on your machine/compiler, please contact me and tell me Xwhere I goofed. X XAll the programs are Copyrighted. Permission for nonprofit use and Xredistribution of the software and its documentation is granted without Xfee. X XComplements, comments, suggestions, fixes, and additions can be sent to: X X Waleed A. Muhanna X P.O. Box 151048 X Columbus, OH 43215 X wmuhanna@magnus.acs.ohio-state.edu X XEnjoy! X XWaleed Muhanna X XFriday 4 Raby` al-awal 1415 A.H. XAugust 8, 1994 END_OF_FILE if test 2340 -ne `wc -c <'ITimer21/README'`; then echo shar: \"'ITimer21/README'\" unpacked with wrong size! fi # end of 'ITimer21/README' fi if test ! -d 'ITimer21/hdate' ; then echo shar: Creating directory \"'ITimer21/hdate'\" mkdir 'ITimer21/hdate' fi if test ! -d 'ITimer21/praytime' ; then echo shar: Creating directory \"'ITimer21/praytime'\" mkdir 'ITimer21/praytime' fi if test ! -d 'ITimer21/premind' ; then echo shar: Creating directory \"'ITimer21/premind'\" mkdir 'ITimer21/premind' fi if test -f 'ITimer21/hdate/Intro.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/Intro.doc'\" else echo shar: Extracting \"'ITimer21/hdate/Intro.doc'\" \(7786 characters\) sed "s/^X//" >'ITimer21/hdate/Intro.doc' <<'END_OF_FILE' X X THE ISLAMIC (HIJRI) CALENDAR X X1. HISTORY AND MOTIVATION X XThe Islamic Calendar, which is based purely on lunar cycles, was first Xintroduced in 638 C.E. by the close companion of the Prophet and the second XCaliph, `Umar ibn Al-KHaTTab (592-644 C.E.). He did it in an attempt to Xrationalize the various, at times conflicting, dating systems used during Xhis time. `Umar consulted with his advisors on the starting date of the Xnew Muslim chronology. It was finally agreed that the most appropriate Xreference point for the Islamic calendar was the _Hijrah_. The actual Xstarting date for the Calendar was chosen (on the basis of purely lunar Xyears, counting backwards) to be the first day of the first month X(1 MuHarram) of the year of the Hijrah. The Islamic (Hijri) calendar X(with dates that fall within the Muslim Era) is usually abbreviated XA.H. in Western languages from the latinized _Anno Hegirae_. MuHarram 1, X1 A.H. corresponds to July 16, 622 C.E. X XThe Hijrah, which chronicles the migration of the Prophet Muhammad X(PBUH) from Makkah to Madinah in September 622 C.E., is the central Xhistorical event of early Islam. It led to the foundation of the first XMuslim city-state, a turning point in Islamic and world history. X XTo Muslims, the Hijri calendar is not just a sentimental system of time Xreckoning and dating important religious events (e.g., Siyaam (fasting) Xand Hajj (pilgrimage to Makkah)). It has a much deeper religious and Xhistorical significance. X XMuhammad Ilyes [Ilyes84] quotes Nadvi who wrote: X ``It (the advent of the 15th century) is indeed, a unique X occasion to ponder that the Islamic Era did not start X with the victories of Islamic wars, nor with the birth X or death of the prophet (PBUH), nor with the Revelation X itself. It starts with Hijra, or the sacrifice for the X cause of Truth and for the preservation of the Revelation. X It was a divinely inspired selection. God wanted to teach X man that struggle between Truth and Evil is eternal. The X Islamic year reminds Muslims every year not of the pomp X and glory of Islam but of its sacrifice and prepares them X to do the same.'' X XFrom a historical angle, Ilyes quotes Samiullah who writes: X ``All the events of Islamic history, especially those which X took place during the life of the Holy Prophet and afterwards X are quoted in the Hijra calendar era. But our calculations X in the Gregorian calendar keep us away from those events and X happenings, which are pregnant of admonitory lessons and guiding X instructions. X ...And this chronological study is possible only by adopting the X Hijri calendar to indicate the year and the lunar month in line X with our cherished traditions.'' X X2. SPECIFICATION AND METHOD X XThe Islamic (Hijri) year consists of twelve (purely lunar) months. XThey are: (1) MuHarram; (2) Safar; (3) Raby` al-awal; (4) Raby` al-THaany; X(5) Jumaada al-awal; (6) Jumaada al-THaany; (7) Rajab; (8) SHa`baan; X(9) RamaDHaan; (10) SHawwal; (11) Thw al-Qi`dah; and (12) Thw al-Hijjah. X XThe most important dates in the Islamic (Hijri) year are: X1 MuHarram (Islamic new year); 27 Rajab (Isra & Miraj); 1 RamaDHaan X(first day of fasting); 17 RamaDHan (Nuzul Al-Qur'an); Last 10 Xdays of RamaDHaan which include Laylatu al-Qadar; 1 SHawwal X(`iyd al-FiTr); 8-10 Thw al-Hijjah (the Hajj to Makkah); and X10 Thw al-Hijjah (`iyd al-'aDHHae). X XIt is considered a divine command to use a (Hijra) calendar with 12 (purely) Xlunar months without intercalation [Ilyes84], as evident from the following Xverses of the Holy Qur`an (Trans: A. Yusuf Ali): X X They ask thee X the New Moons X Say: They are but signs X To mark fixed periods of time X In (the affairs of) men X And for Pilgrimage. (II:189) X X The number of months X In the sight of Allah X Is twelve (in a year) X So ordained by Him X The day He created X The heavens and the earth; X Of them four are scared; X That is the straight usage X So wrong not yourselves X Therein, and fight the Pagans. (IX: 36) X X Verily the transposing X (Of a prohibited month) X Is an addition to Unbelief: X The Unbelievers are led X To wrong thereby: for they make X it lawful one year, X And forbidden another year, X Of months forbidden by Allah X And make such forbidden ones X Lawful. The evil of their course X Seems pleasing to them. X But Allah guideth not X Those who reject Faith. (IX: 37) X XSince the Islamic calendar is purely lunar, as apposed to solar or luni-solar, Xthe Muslim (Hijri) year is shorter than the Gregorian year by about 11 days, Xand months in the Islamic (Hijri) year are not related to seasons, which Xare fundamentally related to the solar cycle. This means that important XMuslim festivals, which always fall in the same Hijri month, may occur Xin different seasons. For example, the Hajj and RamDHaan can take place in Xthe summer as well as the winter. It is only over a 33 year cycle that lunar Xmonths take a complete turn and fall during the same season. X XFor religious reasons, the beginning of a Hijri month is marked not by Xthe start of a new moon, but by a physical (i.e., an actual human) sighting Xof the crescent moon at a given locale. From the Fiqhi standpoint, one may Xbegin the fast in RamDHaan, for example, based on "local" sighting (IKHTILAF XAL-MATALE') or based on sighting anywhere in the Muslim World (ITTEHAD XAL-MATALE'). Although different, both of these positions are valid Fiqhi Xpositions. X XAstronomically, some data are definitive and conclusive (i.e. the time of the XBIRTH of a new moon). However, determining the VISIBILITY of the crescent Xis not as definitive or conclusive; rather it is dependent upon several Xfactors, mostly optical in nature. This makes it difficult to produce X(in advance) Islamic calendars that are reliable (in the sense that they Xare consistent with actual crescent visibility). X XEfforts for obtaining an astronomical criterion for predicting the time of Xfirst lunar visibility go back the the Babylonian era, with significant Ximprovements and work done later by Muslim and other scientists. These Xefforts have resulted in the development in a number of criteria for Xpredicting first possible sighting of a crescent. However, there remains Xa measure of uncertainty associated with all criteria developed thus far. XMoreover, there has been little work in the area of estimating crescent Xvisibility on global (as apposed to local) scale. Until this happens, no XHijri calendar software can be 100% reliable, and actual crescent sighting Xremains essential especially for fixing important dates such as the beginning Xof RamaDHaan and the two `iyds. X XThe slight differences in printed Islamic calendars, worldwide, can therefore Xbe traced to two primary factors: (1) the absence of a global criterion for Xfirst visibility; and (2) the use of different visibility criterion (or Xmethod of calculation). Weather conditions and differences in the observer's Xlocation also explain why there are sometimes differences in the Xobservances of Islamic dates, worldwide. X XReaders interested in further information should consult Mohammad XIlyas' excellent book ``A Modern Guide to Astronomical Calculations of Islamic XCalendar, Times & Qibla,'' Berita Publishing, 1984, (ISBN: 967-969-009-1). XThe book contains a thorough discussion of the Islamic calendrical system Xand related historical and scientific developments. It also presents a sound Xproposal for a universal Islamic Calendar based on a global visibility Xcriterion and the concept of a Lunar Day (or International Lunar Date Line). X XWaleed Muhanna X XTuesday 13 Jumaada al-THaany 1413 A.H. XDecember 8, 1992 END_OF_FILE if test 7786 -ne `wc -c <'ITimer21/hdate/Intro.doc'`; then echo shar: \"'ITimer21/hdate/Intro.doc'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/Intro.doc' fi if test -f 'ITimer21/hdate/Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/Makefile'\" else echo shar: Extracting \"'ITimer21/hdate/Makefile'\" \(553 characters\) sed "s/^X//" >'ITimer21/hdate/Makefile' <<'END_OF_FILE' X# X# Makefile for hdate/hcal X# X# Waleed A. Muhanna X# Ohio State University X# wmuhanna@magnus.acs.ohio-state.edu X# November, 1992 X# X X X#CC= gcc XCFLAGS= -O XDESTDIR=/usr/local X Xall: hdate hcal X Xhdate: hdate.o hconv.o X $(CC) $(CFLAGS) -o hdate hdate.o hconv.o -lm X Xhcal: hcal.o hconv.o X $(CC) $(CFLAGS) -o hcal hcal.o hconv.o -lm X Xinstall: hcal hdate hdate.1 X install -c -s hcal $(DESTDIR)/bin X install -c -s hdate $(DESTDIR)/bin X install -c -m 444 hdate.1 $(DESTDIR)/man/man1 X Xclean: X rm -f hdate hcal hdate.o hcal.o hconv.o X Xhdate.o hcal.o hconv.o: hconv.h END_OF_FILE if test 553 -ne `wc -c <'ITimer21/hdate/Makefile'`; then echo shar: \"'ITimer21/hdate/Makefile'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/Makefile' fi if test -f 'ITimer21/hdate/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/README'\" else echo shar: Extracting \"'ITimer21/hdate/README'\" \(808 characters\) sed "s/^X//" >'ITimer21/hdate/README' <<'END_OF_FILE' X X X XThis directory contains release 2.1 of HDATE/HCAL. This is basically Xa maintenance relase. In this directory you will find the following files: X X README - this file. X Intro.doc - background information on the Islamic Calendar. X hdate.1 - reference manual page for hdate and hcal (nroff/troff -man). X hd-hc.hlp - output of "nroff -man hdate.1 |col -b". X Makefile - the name says it all. Just type "make" to compile. X hdate.c - C source file for hdate. X hcal.c - C source file for hcal. X hconv.c - main conversion routines and supporting utilities. X hconv.h - "include" file containing definitions and "extern" X declarations. X XPlease send your comments, suggestions, fixes, and additions Xto: wmuhanna@magnus.acs.ohio-state.edu X XEnjoy! X XWaleed Muhanna XFriday 4 Raby` al-awal 1415 A.H. XAugust 12, 1994 END_OF_FILE if test 808 -ne `wc -c <'ITimer21/hdate/README'`; then echo shar: \"'ITimer21/hdate/README'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/README' fi if test -f 'ITimer21/hdate/hcal.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hcal.c'\" else echo shar: Extracting \"'ITimer21/hdate/hcal.c'\" \(4049 characters\) sed "s/^X//" >'ITimer21/hdate/hcal.c' <<'END_OF_FILE' X X/* hcal.c X * X * Copyright (c) 1992 by Waleed A. Muhanna X * X * Permission for nonprofit use and redistribution of this software and X * its documentation is hereby granted without fee, provided that the X * above copyright notice appear in all copies and that both that copyright X * notice and this permission notice appear in supporting documentation. X * X * No representation is made about the suitability of this software for any X * purpose. It is provided "as is" without any express or implied warranty. X * X * Send any comments/suggestions/fixes/additions to: X * wmuhanna@magnus.acs.ohio-state.edu X * X */ X X#include X#include X#include "hconv.h" X Xstatic char *progname; Xstatic int hflag=0; X Xmain(argc, argv) X int argc; X char *argv[]; X{ X int d, m, y; X SDATE *sd; X struct tm *tm; X time_t ts; X X void gcal(), hcal(), usage(); X void (*cal)() = gcal; X X progname = *argv++; argc--; X X if (argc>0 && argv[0][0]=='-' && argv[0][1]=='h') { X cal = hcal; hflag++; X argv++; argc--; X } X X if (argc==0) { X ts = time((time_t *)0); tm = localtime(&ts); X y = 1900+tm->tm_year; m = tm->tm_mon+1; X if (hflag) { /* find the current Hijri month */ X d = tm->tm_mday; X sd = hdate(y, m, d); X y= sd->year; m = sd->mon; X } X (*cal)(m,y); X } else if (argc==1) { X y = atoi(argv[0]); X if (y==0||(!hflag && y<0)) X usage("Invalid year/option specified"); X for (m=1; m<=12; m++) (*cal)(m, y); X } else if (argc==2) { X m = atoi(argv[0]); X if (m<=0||m>12) usage("Invalid month number specified"); X y = atoi(argv[1]); X if (y==0||(!hflag && y<0)) usage("Invalid year specified"); X (*cal)(m, y); X } else usage(NULLP); X X exit(0); X X} X Xvoid Xusage(msg) X char *msg; X{ X if (msg != NULLP) fprintf(stderr, "%s: %s\n", progname, msg); X fprintf(stderr, "Usage: %s [-h] [[month] year]\n", progname); X exit (1); X} X X Xvoid Xprintmcal(dw, fday, lday, nd, mday) X int dw, fday, lday, nd, mday; X{ X register i, hi; X X printf(" Sun Mon Tue Wed Thu Fri Sat\n"); X X for (i=0; i0 && ld.year>0) printf(" %d", y); X else if (y>0) printf(" %d A.H.",y); X else printf(" %d B.H.", -y); X yr = ld.year; X } else yr = fd.year; X md.day =0; X if (fd.mon != ld.mon) { X if ((fd.mon 0) printf(" %d A.H.\n",y); else printf(" %d B.H.\n", -y); X printmcal(fd.dw, fd.day, ld.day, nd, md.day); X} X Xvoid Xhcal(m, y) X int m,y; X{ X int nd, hr, min; X float nmt; X SDATE fd, ld; X SDATE *dn; X X fd = *gdate(y, m, 1); X ld = *gdate(y, m+1, 1); X ld = *caldate(julianday(ld.year, ld.mon, ld.day, 0.0) -1.0); X if (fd.mon == ld.mon) X nd = ld.day - fd.day +1; X else X nd = ndays(fd.mon,fd.year) - fd.day + ld.day +1; X X X if (hflag) { X dn = caldate(fd.nmtime); X nmt = 24.0*dn->time; X hr = nmt; X min = 60.0*(nmt-hr)+0.5; X if (min>=60) { min=0; hr += 1;} X printf("(New Moon on %s %s %d, %d at %02d%02d UT)\n", X dow[dn->dw], mname[dn->mon-1], dn->day, dn->year, X hr, min); X } X X printf("%s ", hmname[m-1]); X if (y>0) printf("%4d A.H.",y); else printf("%4d B.H.", -y); X printf(" / %s", mname[fd.mon-1]); X if (fd.year != ld.year) X printf(" %d", fd.year); X if (fd.mon != ld.mon) X printf(" - %s", mname[ld.mon-1]); X printf(" %d C.E.\n", ld.year); X printmcal(fd.dw, fd.day, ld.day, nd, 0); X} END_OF_FILE if test 4049 -ne `wc -c <'ITimer21/hdate/hcal.c'`; then echo shar: \"'ITimer21/hdate/hcal.c'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hcal.c' fi if test -f 'ITimer21/hdate/hconv.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hconv.c'\" else echo shar: Extracting \"'ITimer21/hdate/hconv.c'\" \(6810 characters\) sed "s/^X//" >'ITimer21/hdate/hconv.c' <<'END_OF_FILE' X X/* hconv.c X * X * Copyright (c) 1992 by Waleed A. Muhanna X * X * Permission for nonprofit use and redistribution of this software and X * its documentation is hereby granted without fee, provided that the X * above copyright notice appear in all copies and that both that copyright X * notice and this permission notice appear in supporting documentation. X * X * No representation is made about the suitability of this software for any X * purpose. It is provided "as is" without express or implied warranty. X * X * Send any comments/suggestions/fixes/additions to: X * wmuhanna@magnus.acs.ohio-state.edu X * X */ X X#include X#include "hconv.h" X X#define RPD (0.01745329251994329577) /* radians per degree (pi/180) */ X X Xchar *dow[]= { X "Sunday", "Monday", "Tuesday", "Wednesday", X "Thursday", "Friday", "Saturday" X}; X Xchar *mname[]= { X "January", "February", "March", "April", X "May", "June", "July", "August", X "September", "October", "November", "December" X}; X Xchar *hmname[] = { X "MuHarram", "Safar", "Raby` al-awal", "Raby` al-THaany", X "Jumaada al-awal", "Jumaada al-THaany", "Rajab", "SHa`baan", X "RamaDHaan", "SHawwal", "Thw al-Qi`dah", "Thw al-Hijjah" X}; X X X X/* X * Given an integer _n_ and a phase selector (nph=0,1,2,3 for X * new,first,full,last quarters respectively, function returns the X * Julian date/time of the Nth such phase since January 1900. X * Adapted from "Astronomical Formulae for Calculators" by X * Jean Meeus, Third Edition, Willmann-Bell, 1985. X */ Xdouble Xtmoonphase( n, nph) X long n; int nph; X{ X double jd, t, t2, t3, k, ma, sa, tf, xtra; X k = n + nph/4.0; t = k/1236.85; t2 = t*t; t3 = t2*t; X jd = 2415020.75933 + 29.53058868*k - 1.178e-4 * t2 X - 1.55e-7 * t3 X + 3.3e-4 * sin (RPD * (166.56 +132.87*t -0.009173*t2)); X X /* Sun's mean anomaly */ X sa = RPD * (359.2242 + 29.10535608*k - 3.33e-5 * t2 - 3.47e-6 * t3); X X /* Moon's mean anomaly */ X ma = RPD * (306.0253 + 385.81691806*k + 0.0107306*t2 +1.236e-5 *t3); X X /* Moon's argument of latitude */ X tf = RPD * 2.0 * (21.2964 + 390.67050646*k -0.0016528*t2 X -2.39e-6 * t3); X X /* should reduce to interval 0-1.0 before calculating further */ X if (nph==0 || nph==2) X /* Corrections for New and Full Moon */ X xtra = (0.1734 - 0.000393*t) * sin(sa) X +0.0021*sin(sa*2) X -0.4068*sin(ma) +0.0161*sin(2*ma) -0.0004*sin(3*ma) X +0.0104*sin(tf) X -0.0051*sin(sa+ma) -0.0074*sin(sa-ma) X +0.0004*sin(tf+sa) -0.0004*sin(tf-sa) X -0.0006*sin(tf+ma) +0.0010*sin(tf-ma) X +0.0005*sin(sa+ 2*ma); X else if (nph==1 || nph==3) { X xtra = (0.1721 - 0.0004*t) * sin(sa) X +0.0021*sin(sa*2) X -0.6280*sin(ma) +0.0089*sin(2*ma) -0.0004*sin(3*ma) X +0.0079*sin(tf) X -0.0119*sin(sa+ma) -0.0047*sin(sa-ma) X +0.0003*sin(tf+sa) -0.0004*sin(tf-sa) X -0.0006*sin(tf+ma) +0.0021*sin(tf-ma) X +0.0003*sin(sa+ 2*ma) +0.0004*sin(sa-2*ma) X -0.0003*sin(2*sa+ma); X if (nph==1) X xtra = xtra +0.0028 -0.0004*cos(sa) +0.0003*cos(ma); X else X xtra = xtra -0.0028 +0.0004*cos(sa) -0.0003*cos(ma); X } else { X printf("tmoonphase: illegal phase number\n"); X exit(1); X } X /* convert from Ephemeris Time (ET) to (approximate) X Universal Time (UT) */ X jd += xtra - (0.41 +1.2053*t +0.4992*t2)/1440; X return (jd); X} X X X/* parameters for Makkah: for a new moon to be visible after sunset on X a the same day in which it started, it has to have started before X (SUNSET-MINAGE)-TIMZ=3 A.M. local time. */ X X#define TIMZ 3.0 X#define MINAGE 13.5 X#define SUNSET 19.5 /*approximate */ X#define TIMDIF (SUNSET-MINAGE) X Xdouble Xvisible(n, rjd) X long n; X double *rjd; X{ X double jd; X float tf; X long d; X X jd = tmoonphase(n,0); *rjd = jd; X d = jd; X tf = (jd - d); X if (tf<=0.5) /*new moon starts in the afternoon */ X return(jd+1.0); X /* new moon starts before noon */ X tf = (tf-0.5)*24 +TIMZ; /* local time */ X if (tf>TIMDIF) return(jd+1.0); /*age at sunset < min for visiblity*/ X return(jd); X} X X/* X * Returns the Julian date (the Julian day number at _time_) of the X * given calendar date specified by _year_, _month_, and _day_. X * Positive year signifies A.D.; negative, B.C. X */ Xdouble Xjulianday( year, month, day, time) X int year, month, day; X float time; X{ X double jul; X long m,y,ja; X X if (year<0) year++; X if (month>2) { X y = year; m =month; X } else { X y = year-1; m =month+12; X } X jul = ((double)y) * 365.25; X if (y<1) jul -= 0.75; X jul = ((long) jul) + ( (long) (30.6001*(m+1))) +day +time +1720994.5; X if (year +month*1e-2 +(day+time)*1e-4 >= 1582.1015) { X /* cross-over to Gregorian calendar */ X ja = 0.01*y; X jul = jul +2 -ja + ((long) (0.25*ja)); X } X return jul; X} X X/* X * inverse function of Julianday. X */ XSDATE * Xcaldate( julday ) X double julday; X{ X static SDATE sd; X long z, alpha, a, b, c, d, e; X double f; X X julday += 0.5; z = julday; f = julday-z; X if ( z<2299161L ) /* test whether to change to Gregorian cal */ X a = z; X else { X alpha = (z-1867216.25) / 36524.25; X a = z + 1 +alpha - alpha / 4; X } X b = a + 1524; c = (b - 122.1) / 365.25; d = 365.25 * c; X e = (b-d) / 30.6001; X f += b -d - ((long) (30.6001*e)); X sd.day = f; X sd.time = f-sd.day; X sd.mon = (e>13) ? e-13 : e-1; X sd.year = (sd.mon>2) ? c-4716 : c-4715; X /* X sd.dw = ((long) (julianday(sd.year,sd.mon, sd.day, 0.0) + 1.5)) % 7; X */ X sd.dw = ((long) (julday -sd.time + 1.1)) % 7; X if ( sd.year<=0) sd.year--; X return(&sd); X} X X X X/* X * Given a gregorian/julian date, compute corresponding Hijri date structure X * As a reference point, the routine uses the fact that the year X * 1405 A.H. started immediatly after lunar conjunction number 1048 X * which occured on September 1984 25d 3h 10m UT. X */ XSDATE * Xhdate (y,m,d) X int y, m, d; X{ X static SDATE h; X double jd, mjd, rjd; X long k, hm; X X jd = julianday(y,m,d,0.00); X /* obtain first approx. of how many new moons since the beginning X of the year 1900 */ X k = 0.6 + (y + ((int) (m-0.5)) /12.0 + d/365.0 - 1900) *12.3685; X do {mjd = visible(k--, &rjd);} while (mjd>jd); k++; X /*first of the month is the following day*/ X hm = k -1048; X h.year = 1405 + (hm / 12); X X h.mon = (hm % 12) +1; X if (hm !=0 && h.mon<=0) {h.mon +=12; h.year--; } X if (h.year<=0) h.year--; X h.day = jd -mjd +1.0; X h.time = 0.5; X h.dw = ((long) (jd+1.5)) % 7; X return(&h); X} X X#define NMONTHS (1405*12+1) X X/* X * Given a Hijri date, compute corresponding C.E. date structure X */ XSDATE * Xgdate( y, m, d) X int y,m,d; X{ X double jd, rjd; X long k; X SDATE *sd; X X if (y<0) y++; X k = m+ y*12 - NMONTHS; /* # of months since 1/1/1405 */ X jd = visible(k+1048L, &rjd) +d; X sd = caldate(jd); X sd->nmtime = rjd; X return (sd); X} X X Xint Xndays(m,y) X int m,y; X{ X static short ndmnth[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; X X int nd = ndmnth[m]; X if (m==2 && (y%4==0 && (y<1582 || y%100!=0 || y%400==0))) nd++; X return nd; X} END_OF_FILE if test 6810 -ne `wc -c <'ITimer21/hdate/hconv.c'`; then echo shar: \"'ITimer21/hdate/hconv.c'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hconv.c' fi if test -f 'ITimer21/hdate/hconv.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hconv.h'\" else echo shar: Extracting \"'ITimer21/hdate/hconv.h'\" \(328 characters\) sed "s/^X//" >'ITimer21/hdate/hconv.h' <<'END_OF_FILE' X Xextern char *mname[], *hmname[], *dow[]; X Xtypedef struct sdate { X float time; X int day; X int mon; X int year; X int dw; X double nmtime; X} SDATE; X Xextern SDATE *caldate(), *hdate(), *gdate(); X Xextern double tmoonphase(), julianday(); Xextern int ndays(); X X#define NULLP ((char *)0) X X/* for portability */ X#include END_OF_FILE if test 328 -ne `wc -c <'ITimer21/hdate/hconv.h'`; then echo shar: \"'ITimer21/hdate/hconv.h'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hconv.h' fi if test -f 'ITimer21/hdate/hd-hc.hlp' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hd-hc.hlp'\" else echo shar: Extracting \"'ITimer21/hdate/hd-hc.hlp'\" \(6015 characters\) sed "s/^X//" >'ITimer21/hdate/hd-hc.hlp' <<'END_OF_FILE' X X X X HDATE(1L) (hdate/hcal Version 2.1) HDATE(1L) X X X X NAME X hdate, hcal - Islamic (Hijri) date and calendar X X SYNOPSIS X hdate [day month year] X hdate [-h day month year] X X hcal [-h] [[month] year ] X X DESCRIPTION X For a given date, hdate prints the corresponding Islamic X (Hijri) date. If no arguments are given, it uses the X current (today's) date. If the -h command option is X specified, hdate takes the given date as a Hijri date, and X translates it back to the common calendar. (The common X calendar is the Gregorian calendar for years after 1582 and X the Julian calendar for years before that.) X X hcal prints a calendar with both common and Hijri dates. If X no arguments are given, the current month is used. If a X year is specified, the program outputs a calendar for that X entire year. If a month is also specified, a calendar just X for that month is printed. If the -h option is specified, X hcal takes the given month/year as a Hijri month/year, and X produces a calendar accordingly. If no Hijri month/year is X given, a calendar for the current Hijri month is printed. X When the -h option is used, the program will also print the X time of the start of the new moon whose first visibility X marks the beginning of the Hijri month. X X The month is a number between 1 and 12. For Christian Era X (C.E.) dates, a year must be positive (i.e., A.D.). For X Hijri dates, a positive year signifies After Hijrah or Anno X Hegirae (A.H.); a negative year signifies Before Hijrah X (B.H.). (The year after 1 B.H. was 1 A.H.; there is no year X zero.) X X The Hijri year consists of 12 (purely) lunar months. They X are: (1) MoHarram; (2) Safar; (3) Raby` al-awal; (4) Raby` X al-THaany; (5) Jumaada al-awal; (6) Jumaada al-THaany; (7) X Rajab; (8) SHa`baan; (9) RamaDHaan; (10) SHawwal; (11) Thw X al-Qi`dah; and (12) Thw al-Hijjah. The most important X dates in the Islamic year are: 1 MoHarram (new year); 1 X RamaDHaan (first day of fasting); 1 SHawwal (`iyd al-FiTr); X 8-10 Thw al-Hijjah (the Hajj to Makkah); 10 Thw al-Hijjah X (`iyd al-'aDHHae). X X EXAMPLES X To find out the current Hijri date, simply enter: X X hdate X X X X X Page 1 (printed 8/22/94) X X X X X X X HDATE(1L) (hdate/hcal Version 2.1) HDATE(1L) X X X X To display the Gregorian date corresponding to the 1st of X RamaDHaan (the 9th month) of the Hijri year 1413, type: X X hdate -h 1 9 1413 X X To find out the Hijri date of the battle of HiTiyn, enter: X X hdate 4 6 1187 X X To produce a (Gregorian/Hijri) calendar for December 1992, X enter: X X hcal 12 1992 X X To display a (Hijri/Gregorian) calendar for the year 1413 X Hijriah, enter: X X hcal -h 1413 X X X NOTES and METHOD DESCRIPTION X For religious reasons, the beginning of a Hijri month is X marked not by the start of a new moon, but by a physical X (i.e., an actual human) sighting of the crescent moon at a X given locale. From the Fiqhi standpoint, one may begin the X fast in RamaDHaan, for example, based on "local" sighting X (IKHTILAF AL-MATALE') or based on sighting anywhere in the X Muslim World (ITTEHAD AL-MATALE'). Although different, both X of these positions are valid Fiqhi positions. X X Astronomically, some data are definitive and conclusive X (i.e. the time of the BIRTH of the crescent). However, X determining the VISIBILITY of the crescent is not as X definitive or conclusive; rather it is dependent upon X several factors, mostly optical in nature. X X Efforts for obtaining an astronomical criterion for X predicting the time of first lunar visibility go back the X the Babylonian era, with significant improvements and work X done later by Muslim and other scientists. These efforts X have resulted in the development in a number of criteria for X predicting first possible sighting of a crescent. However, X there remains a measure of uncertainty associated with all X criteria developed thus far. Moreover, there has been little X work in the area of estimating crescent visibility on global X (as opposed to local) scale. Until this happens, no Hijri X calendar software can be 100% reliable, and actual crescent X sighting remains essential especially for fixing important X dates such as the beginning of RamaDHaan and the two `iyds. X X The slight differences in printed Islamic calendars, X worldwide, can be traced to two factors: (1) the absence of X X X X Page 2 (printed 8/22/94) X X X X X X X HDATE(1L) (hdate/hcal Version 2.1) HDATE(1L) X X X X a global criterion for first visibility; and (2) the use of X different visibility criterion (or method of calculation). X Weather conditions and differences in the observer's X location also explain why there are sometimes differences in X the observances of Islamic dates, worldwide. X X hcal and hdate use one of the simplest astronomical X criterion for earlist lunar visibility. The criterion is a X local one and is based on the moon's age since the lunar X conjunction (the start of the new moon). X X The minimum recorded age of the crescent moon for first X visibility is around 13 1/2 hours. hcal and hdate take this X into consideration to determine the likelihood of the X crescent being sighted just after the first sun set (assumed X to occur at 7:30p.m.) following the new moon. And since X there is no agreed upon international Lunar date-line, hcal X and hdate currently use Makkah (+3 GMT) for the locale. X X It is the authors' view that hdate/hcal produces X dates/calendars that are more reliable than many of the X Islamic calendars which are printed annually in various X Muslim communities. The programs, moreover, provide X astronomically based information which can be used to X support the actual sighting of a crescent moon. X X AUTHOR X Waleed A. Muhanna (wmuhanna@magnus.acs.ohio-state.edu). X X X X X X X X X X X X X X X X X X X X X X X X X X X X Page 3 (printed 8/22/94) X X X END_OF_FILE if test 6015 -ne `wc -c <'ITimer21/hdate/hd-hc.hlp'`; then echo shar: \"'ITimer21/hdate/hd-hc.hlp'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hd-hc.hlp' fi if test -f 'ITimer21/hdate/hdate.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hdate.1'\" else echo shar: Extracting \"'ITimer21/hdate/hdate.1'\" \(5706 characters\) sed "s/^X//" >'ITimer21/hdate/hdate.1' <<'END_OF_FILE' X.TH HDATE 1L "hdate/hcal Version 2.1" X.UC 4 X.SH NAME Xhdate, hcal \- Islamic (Hijri) date and calendar X.SH SYNOPSIS X\fBhdate\fR [\fIday\fR \fImonth\fR \fIyear\fR] X.br X\fBhdate\fR [\fB-h\fR \fIday\fR \fImonth\fR \fIyear\fR] X.PP X\fBhcal\fR [\fB-h\fR] [[\fImonth\fR\] \fIyear\fR ] X.SH DESCRIPTION XFor a given date, \fIhdate\fR prints the corresponding Islamic (Hijri) date. XIf no arguments are given, it uses the current (today's) date. If the X.B \-h Xcommand option is specified, \fIhdate\fP takes the given date as a Hijri date, Xand translates it back to the common calendar. (The common calendar is Xthe Gregorian calendar for years after 1582 and the Julian calendar for Xyears before that.) X.PP X\fIhcal\fP prints a calendar with both common and Hijri dates. XIf no arguments are given, the current month is used. If a year is Xspecified, the program outputs a calendar for that entire year. If Xa month is also specified, a calendar just for that month is Xprinted. If the X.B \-h Xoption is specified, \fIhcal\fP takes the given month/year as a Hijri Xmonth/year, and produces a calendar accordingly. If no Hijri month/year Xis given, a calendar for the current Hijri month is printed. When the X.B \-h Xoption is used, the program will also print the time of the start of Xthe new moon whose first visibility marks the beginning of the Hijri month. X.PP XThe \fImonth\fP is a number between 1 and 12. For Christian Era (C.E.) Xdates, a \fIyear\fP must be positive (i.e., A.D.). For Hijri dates, Xa positive \fIyear\fP signifies After Hijrah or Anno Hegirae (A.H.); Xa negative year signifies Before Hijrah (B.H.). X(The year after 1 B.H. was 1 A.H.; there is no year zero.) X.PP XThe Hijri year consists of 12 (purely) lunar months. They are: (1) MoHarram; X(2) Safar; (3) Raby` al-awal; (4) Raby` al-THaany; (5) Jumaada al-awal; X(6) Jumaada al-THaany; (7) Rajab; (8) SHa`baan; (9) RamaDHaan; (10) SHawwal; X(11) Thw al-Qi`dah; and (12) Thw al-Hijjah. The most important dates in Xthe Islamic year are: 1 MoHarram (new year); 1 RamaDHaan (first day of Xfasting); 1 SHawwal (`iyd al-FiTr); 8-10 Thw al-Hijjah (the Hajj to Makkah); X10 Thw al-Hijjah (`iyd al-'aDHHae). X.SH EXAMPLES XTo find out the current Hijri date, simply enter: X.RS X.sp Xhdate X.sp X.RE XTo display the Gregorian date corresponding to the 1st of RamaDHaan X(the 9th month) of the Hijri year 1413, type: X.RS X.sp Xhdate -h 1 9 1413 X.sp X.RE XTo find out the Hijri date of the battle of HiTiyn, enter: X.RS X.sp Xhdate 4 6 1187 X.sp X.RE XTo produce a (Gregorian/Hijri) calendar for December 1992, enter: X.RS X.sp Xhcal 12 1992 X.sp X.RE XTo display a (Hijri/Gregorian) calendar for the year 1413 Hijriah, Xenter: X.RS X.sp Xhcal -h 1413 X.sp X.RE X.PP X.SH "NOTES and METHOD DESCRIPTION" XFor religious reasons, the beginning of a Hijri month is marked not by Xthe start of a new moon, but by a physical (i.e., an actual human) sighting Xof the crescent moon at a given locale. From the Fiqhi standpoint, one may Xbegin the fast in RamaDHaan, for example, based on "local" sighting (IKHTILAF XAL-MATALE') or based on sighting anywhere in the Muslim World (ITTEHAD XAL-MATALE'). Although different, both of these positions are valid Fiqhi Xpositions. X.PP XAstronomically, some data are definitive and conclusive (i.e. the time of the XBIRTH of the crescent). However, determining the VISIBILITY of the crescent Xis not as definitive or conclusive; rather it is dependent upon several Xfactors, mostly optical in nature. X.PP XEfforts for obtaining an astronomical criterion for predicting the time of Xfirst lunar visibility go back the the Babylonian era, with significant Ximprovements and work done later by Muslim and other scientists. These Xefforts have resulted in the development in a number of criteria for Xpredicting first possible sighting of a crescent. However, there remains Xa measure of uncertainty associated with all criteria developed thus far. XMoreover, there has been little work in the area of estimating crescent Xvisibility on global (as opposed to local) scale. Until this happens, no XHijri calendar software can be 100% reliable, and actual crescent sighting Xremains essential especially for fixing important dates such as the beginning Xof RamaDHaan and the two `iyds. X.PP XThe slight differences in printed Islamic calendars, worldwide, can be Xtraced to two factors: (1) the absence of a global criterion for first Xvisibility; and (2) the use of different visibility criterion (or method Xof calculation). Weather conditions and differences in the observer's Xlocation also explain why there are sometimes differences in the Xobservances of Islamic dates, worldwide. X.PP X\fIhcal\fP and \fIhdate\fP use one of the simplest astronomical criterion Xfor earlist lunar visibility. The criterion is a local one and is based Xon the moon's age since the lunar conjunction (the start of the new moon). X.PP XThe minimum recorded age of the crescent moon for first visibility is around X13 1/2 hours. \fIhcal\fP and \fIhdate\fP take this into consideration Xto determine the likelihood of the crescent being sighted just after Xthe first sun set (assumed to occur at 7:30p.m.) following the new moon. XAnd since there is no agreed upon international Lunar date-line, \fIhcal\fP Xand \fIhdate\fP currently use Makkah (+3 GMT) for the locale. X.PP XIt is the authors' view that \fIhdate\fP/\fIhcal\fP produces dates/calendars Xthat are more reliable than many of the Islamic calendars which are Xprinted annually in various Muslim communities. The programs, moreover, Xprovide astronomically based information which can be used to support the Xactual sighting of a crescent moon. X.SH AUTHOR XWaleed A. Muhanna (wmuhanna@magnus.acs.ohio-state.edu). END_OF_FILE if test 5706 -ne `wc -c <'ITimer21/hdate/hdate.1'`; then echo shar: \"'ITimer21/hdate/hdate.1'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hdate.1' fi if test -f 'ITimer21/hdate/hdate.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/hdate.c'\" else echo shar: Extracting \"'ITimer21/hdate/hdate.c'\" \(2054 characters\) sed "s/^X//" >'ITimer21/hdate/hdate.c' <<'END_OF_FILE' X X/* hdate.c v1.1 X * X * Copyright (c) 1992 by Waleed A. Muhanna X * X * Permission for nonprofit use and redistribution of this software and X * its documentation is hereby granted without fee, provided that the X * above copyright notice appear in all copies and that both that copyright X * notice and this permission notice appear in supporting documentation. X * X * No representation is made about the suitability of this software for any X * purpose. It is provided "as is" without express or implied warranty. X * X * Send any comments/suggestions/fixes/additions to: X * wmuhanna@magnus.acs.ohio-state.edu X * X */ X X#include X#include X#include "hconv.h" X Xstatic char *progname; X Xmain(argc, argv) X int argc; X char *argv[]; X{ X int d, m, y, hflag=0; X SDATE *sd; X struct tm *tm; X time_t ts; X void usage(); X X progname = *argv++; argc--; X X X if (argc>0 && argv[0][0]=='-' && argv[0][1]=='h') { X hflag++; argv++; argc--; X } X X if (argc==0) { X if (hflag) usage("Hijri date must be given"); X ts = time((time_t *)0); tm = localtime(&ts); X y = 1900+tm->tm_year; m = tm->tm_mon+1; d = tm->tm_mday; X } else if (argc==3) { X d = atoi(argv[0]); X m = atoi(argv[1]); X if (m<1||m>12) usage("Invalid month number specified"); X y = atoi(argv[2]); X if (y==0 || (!hflag && y<0)) usage("Invalid year specified"); X if (hflag && d>30) usage("Invalid Hijri day number specified"); X if (d<1 || (!hflag && d>ndays(m,y))) X usage("Invalid day number specified"); X } else X usage(NULLP); X X if (hflag) { X sd = gdate(y, m, d); X printf("%s %d %s %d C.E.\n", dow[sd->dw], sd->day, X mname[sd->mon-1], sd->year); X } else { X sd = hdate(y, m, d); X printf("%s %d %s", dow[sd->dw], sd->day, hmname[sd->mon-1]); X if (sd->year>0) printf(" %d A.H.\n", sd->year); X else printf(" %d B.H.\n", -sd->year); X } X exit(0); X} X Xvoid Xusage(msg) X char *msg; X{ X if (msg != NULLP) fprintf(stderr, "%s: %s\n", progname, msg); X fprintf(stderr, X "Usage: %s [ [day month year] | [-h hday hmonth hyear] ]\n", X progname); X exit(1); X} END_OF_FILE if test 2054 -ne `wc -c <'ITimer21/hdate/hdate.c'`; then echo shar: \"'ITimer21/hdate/hdate.c'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/hdate.c' fi if test -f 'ITimer21/hdate/makefile.msc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/hdate/makefile.msc'\" else echo shar: Extracting \"'ITimer21/hdate/makefile.msc'\" \(437 characters\) sed "s/^X//" >'ITimer21/hdate/makefile.msc' <<'END_OF_FILE' X# X# Makefile for hdate/hcal (Microsoft C) X# X# Waleed A. Muhanna X# Ohio State University X# wmuhanna@magnus.acs.ohio-state.edu X# August, 1994 X# X X X#CC= gcc X#CFLAGS= -O X Xall: hdate hcal X Xhdate: hdate.obj hconv.obj X $(CC) $(CFLAGS) -o hdate hdate.obj hconv.obj X Xhcal: hcal.obj hconv.obj X $(CC) $(CFLAGS) -o hcal hcal.obj hconv.obj X Xclean: X -del hdate X -del hcal X -del *.obj X Xhdate.obj hcal.obj hconv.obj: hconv.h X END_OF_FILE if test 437 -ne `wc -c <'ITimer21/hdate/makefile.msc'`; then echo shar: \"'ITimer21/hdate/makefile.msc'\" unpacked with wrong size! fi # end of 'ITimer21/hdate/makefile.msc' fi if test -f 'ITimer21/praytime/Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/Makefile'\" else echo shar: Extracting \"'ITimer21/praytime/Makefile'\" \(5007 characters\) sed "s/^X//" >'ITimer21/praytime/Makefile' <<'END_OF_FILE' X# X# Makefile for praytime X# X# Waleed A. Muhanna X# Ohio State University X# wmuhanna@magnus.acs.ohio-state.edu X# August, 1994 X# X X X# Comment out the line for Columbus X# Uncomment or add a line with the appropriate data for your city. X# (check the data for accuracy, particularly for cities outside the US.) X#----------------------------------------------------------------------------- X# Time Adjust for DayLight X# CITY Latitude Longitude Zone Saving Time? X#----------------------------------------------------------------------------- X#PTLOC= Anchorage, AK 61 13 N 149 53 W -10 Y X#PTLOC= Ann Arbor, MI 42 17 N 83 45 W -5 Y X#PTLOC= Atlanta, GA 33 45 N 84 23 W -5 Y X#PTLOC= Boston, MA 42 21 N 71 03 W -5 Y X#PTLOC= Chicago, IL 41 51 N 87 39 W -6 Y X#PTLOC= Cincinnati, OH 39 10 N 84 27 W -5 Y X#PTLOC= Cleveland, OH 41 30 N 81 42 W -5 Y X XPTLOC= Columbus, OH 39 58 N 83 00 W -5 Y X X#PTLOC= Dallas, TX 32 47 N 96 48 W -6 Y X#PTLOC= Denver, CO 39 44 N 104 59 W -7 Y X#PTLOC= Detroit, MI 42 20 N 83 03 W -5 Y X#PTLOC= Honolulu, HI 21 18 N 157 52 W -10 Y X#PTLOC= Houston, TX 29 46 N 95 22 W -6 Y X#PTLOC= Indianapolis, IN 39 46 N 86 09 W -5 Y X#PTLOC= Kansas City, MO 39 06 N 94 35 W -6 Y X#PTLOC= Los Angeles, CA 34 03 N 118 15 W -8 Y X#PTLOC= Madison, WI 43 04 N 89 24 W -6 Y X#PTLOC= Miami, FL 25 46 N 80 12 W -5 Y X#PTLOC= Milwaukee, WI 43 02 N 87 54 W -5 Y X#PTLOC= Minneapolis, MN 44 59 N 93 16 W -6 Y X#PTLOC= New Orleans, LA 29 57 N 90 05 W -6 Y X#PTLOC= New York, NY 40 43 N 74 00 W -5 Y X#PTLOC= Oklahoma City, OK 35 28 N 97 31 W -6 Y X#PTLOC= Orlando, FL 28 32 N 81 23 W -5 Y X#PTLOC= Philadelphia, PA 39 57 N 75 10 W -5 Y X#PTLOC= Pittsburgh, PA 40 26 N 80 00 W -5 Y X#PTLOC= Portland, OR 45 31 N 122 41 W -8 Y X#PTLOC= Raleigh, NC 35 46 N 78 38 W -5 Y X#PTLOC= San Diego, CA 32 43 N 117 09 W -8 Y X#PTLOC= San Francisco, CA 37 47 N 122 25 W -8 Y X#PTLOC= Seattle, WA 47 36 N 122 20 W -8 Y X#PTLOC= Tampa, FL 27 57 N 82 28 W -5 Y X#PTLOC= Toronto, Ontario 43 39 N 79 23 W -5 Y X#PTLOC= Tucson, AZ 32 13 N 110 56 W -7 Y X#PTLOC= Vancouver, BC 49 19 N 123 05 W -8 Y X#PTLOC= Washington, DC 38 54 N 77 02 W -5 Y X X#PTLOC= Makkah, S. Arabia 21 25 N 39 49 E +3 N X#PTLOC= Maddinah, S. Arabia 24 30 N 39 35 E +3 N X#PTLOC= Al-Quds, Palestine 31 47 N 35 13 E +2 Y X X#PTLOC= Alexandria, Egypt 31 13 N 29 55 E +2 Y X#PTLOC= Algiers, Algeria 36 48 N 03 00 E +1 N X#PTLOC= Baghdad, `Iraq 33 20 N 44 26 E +3 N X#PTLOC= Beirut, Lebanon 33 52 N 35 30 E +3 N X#PTLOC= Cairo, Egypt 30 03 N 31 15 E +2 Y X#PTLOC= Damascus, Syria 33 30 N 36 19 E +2 N X#PTLOC= Khartoum, Sudan 15 30 N 32 36 E +2 N X#PTLOC= Rabat, Morocco 34 02 N 06 51 W +0 N X#PTLOC= Riyadh, S. Arabia 24 39 N 46 46 E +3 N X X#PTLOC= Agra, India 27 12 N 77 54 E +5 N X#PTLOC= Dacca, Bangladesh 23 48 N 90 27 E +6 N X#PTLOC= Istanbul, Turkey 41 02 N 28 57 E +2 N X#PTLOC= Jakarta, Indonesia 06 08 S 106 45 E +7 N X#PTLOC= Peshawar, Pakistan 34 01 N 71 40 E +5 N X#PTLOC= Tehran, Iran 35 40 N 51 26 E +3 N X X#PTLOC= Dar el-Salaam, Tanz. 06 48 S 39 12 E +3 N X#PTLOC= Dakar, Senegal 14 42 N 17 30 W +0 N X#PTLOC= Lagos, Nigeria 06 30 N 03 24 E +1 N X#PTLOC= Capetown, S. Africa 33 48 S 18 36 E +2 N X#PTLOC= Moscow, Russia 55 45 N 37 42 E +2 N X X#PTLOC= Tokyo, Japan 35 40 N 139 45 E +9 N X#PTLOC= Sydney, Australia 33 53 S 151 10 E +10 N X X#PTLOC= Paris, France 48 52 N 02 20 E +1 N X#PTLOC= London, England 51 30 N 00 10 W +0 N X X#PTLOC= Buenos Aires, Argant. 34 42 S 58 24 W -3 N X#PTLOC= Lima, Peru 12 24 S 77 00 W -5 N X#PTLOC= Rio DeJeneiro, Brazil 22 54 S 43 12 W -3 N X X#CC= gcc XCFLAGS= -O -I../hdate -DPTLOC=\""$(PTLOC)"\" X Xpraytime: praytime.c ../hdate/hconv.o Makefile X $(CC) $(CFLAGS) -o praytime praytime.c ../hdate/hconv.o -lm X X../hdate/hconv.o: ../hdate/hconv.h ../hdate/hconv.c X (cd ../hdate; $(CC) -O -c hconv.c) X Xclean: X rm -f praytime core praytime.o END_OF_FILE if test 5007 -ne `wc -c <'ITimer21/praytime/Makefile'`; then echo shar: \"'ITimer21/praytime/Makefile'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/Makefile' fi if test -f 'ITimer21/praytime/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/README'\" else echo shar: Extracting \"'ITimer21/praytime/README'\" \(2264 characters\) sed "s/^X//" >'ITimer21/praytime/README' <<'END_OF_FILE' X X XThis directory contains release 2.1 PRAYTIME. PRAYTIME is a modified version Xof Kamal Abdali's program "prayertime." X XThis distribution includes the following files: X README - this file. X praytime.1 - reference manual page (nroff/troff -man). X praytime.hlp - output of "nroff -man praytime.1 |col -b". X Makefile - also contains geographical coordinates of many cities. X praytime.c - C source file for praytime. X XCOMPILING PRAYTIME: X XThe computation of the times of prayers for a given location involves the Xdetermination of times of specific Sun positions (e.g., sunrise, sunset, Xmidday, twilight) at that location. Thus, in order to install PRAYTIME, Xyou need to edit the Makefile to specify the geographical data for your Xlocation, then type "make". (If you wish to force a recompilation, type X"make clean" and then type "make".) X XThe Makefile already contains information (longitude and latitude) about most Xmajor cities in the US and a number of cities elsewhere. If you are in the XUS, and information about your town/city is not already included in the XMakefile, you may use the Geographic Name Server (courtesy of the U. of XMichigan) to find out the exact latitude and longitude of your city/town. XSimply telnet to port 3000 at martini.eecs.umich.edu and type your ZIP code. XHere is an example: X X %telnet martini.eecs.umich.edu 3000 X Trying 141.212.99.9... X Connected to martini.eecs.umich.edu. X Escape character is '^]'. X # Geographic Name Server, Copyright 1992 Regents of the University of Michigan. X # Version 8/19/92. Use "help" or "?" for assistance, "info" for hints. X . X X 43210 X X 0 Columbus X 1 39049 Franklin X 2 OH Ohio X 3 US United States X R county seat, state capital X F 45 Populated place X L 39 57 40 N 82 59 56 W X P 564871 X E 744 X Z 43085 43200 43201 43202 43203 43204 43205 43206 43207 43209 X Z 43211 43212 43213 43214 43215 43216 43217 43218 43219 43220 X Z 43222 43223 43224 43226 43227 43228 43229 43230 43231 43232 X Z 43236 43251 43253 43260 43265 43266 43267 43268 43269 43270 X Z 43285 43286 43287 43291 X . X ^] X telnet> q X XIf your town/city is outside the US, you may be able to find its Xlongitude and latitude by calling your local airport or library. X XWa Al-salaam, X XWaleed A. Muhanna X(wmuhanna@magnus.acs.ohio-state.edu) END_OF_FILE if test 2264 -ne `wc -c <'ITimer21/praytime/README'`; then echo shar: \"'ITimer21/praytime/README'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/README' fi if test -f 'ITimer21/praytime/dc.dat' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/dc.dat'\" else echo shar: Extracting \"'ITimer21/praytime/dc.dat'\" \(36 characters\) sed "s/^X//" >'ITimer21/praytime/dc.dat' <<'END_OF_FILE' XWashington, DC 38 54 N 77 2 W -5 Y END_OF_FILE if test 36 -ne `wc -c <'ITimer21/praytime/dc.dat'`; then echo shar: \"'ITimer21/praytime/dc.dat'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/dc.dat' fi if test -f 'ITimer21/praytime/makefile.msc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/makefile.msc'\" else echo shar: Extracting \"'ITimer21/praytime/makefile.msc'\" \(5090 characters\) sed "s/^X//" >'ITimer21/praytime/makefile.msc' <<'END_OF_FILE' X# X# Makefile for praytime X# X# Waleed A. Muhanna X# Ohio State University X# wmuhanna@magnus.acs.ohio-state.edu X# August, 1994 X# X X X# Comment out the line for Columbus X# Uncomment or add a line with the appropriate data for your city. X# (check the data for accuracy, particularly for cities outside the US.) X#----------------------------------------------------------------------------- X# Time Adjust for DayLight X# CITY Latitude Longitude Zone Saving Time? X#----------------------------------------------------------------------------- X#PTLOC= Anchorage, AK 61 13 N 149 53 W -10 Y X#PTLOC= Ann Arbor, MI 42 17 N 83 45 W -5 Y X#PTLOC= Atlanta, GA 33 45 N 84 23 W -5 Y X#PTLOC= Boston, MA 42 21 N 71 03 W -5 Y X#PTLOC= Chicago, IL 41 51 N 87 39 W -6 Y X#PTLOC= Cincinnati, OH 39 10 N 84 27 W -5 Y X#PTLOC= Cleveland, OH 41 30 N 81 42 W -5 Y X XPTLOC= Columbus, OH 39 58 N 83 00 W -5 Y X X#PTLOC= Dallas, TX 32 47 N 96 48 W -6 Y X#PTLOC= Denver, CO 39 44 N 104 59 W -7 Y X#PTLOC= Detroit, MI 42 20 N 83 03 W -5 Y X#PTLOC= Honolulu, HI 21 18 N 157 52 W -10 Y X#PTLOC= Houston, TX 29 46 N 95 22 W -6 Y X#PTLOC= Indianapolis, IN 39 46 N 86 09 W -5 Y X#PTLOC= Kansas City, MO 39 06 N 94 35 W -6 Y X#PTLOC= Los Angeles, CA 34 03 N 118 15 W -8 Y X#PTLOC= Madison, WI 43 04 N 89 24 W -6 Y X#PTLOC= Miami, FL 25 46 N 80 12 W -5 Y X#PTLOC= Milwaukee, WI 43 02 N 87 54 W -5 Y X#PTLOC= Minneapolis, MN 44 59 N 93 16 W -6 Y X#PTLOC= New Orleans, LA 29 57 N 90 05 W -6 Y X#PTLOC= New York, NY 40 43 N 74 00 W -5 Y X#PTLOC= Oklahoma City, OK 35 28 N 97 31 W -6 Y X#PTLOC= Orlando, FL 28 32 N 81 23 W -5 Y X#PTLOC= Philadelphia, PA 39 57 N 75 10 W -5 Y X#PTLOC= Pittsburgh, PA 40 26 N 80 00 W -5 Y X#PTLOC= Portland, OR 45 31 N 122 41 W -8 Y X#PTLOC= Raleigh, NC 35 46 N 78 38 W -5 Y X#PTLOC= San Diego, CA 32 43 N 117 09 W -8 Y X#PTLOC= San Francisco, CA 37 47 N 122 25 W -8 Y X#PTLOC= Seattle, WA 47 36 N 122 20 W -8 Y X#PTLOC= Tampa, FL 27 57 N 82 28 W -5 Y X#PTLOC= Toronto, Ontario 43 39 N 79 23 W -5 Y X#PTLOC= Tucson, AZ 32 13 N 110 56 W -7 Y X#PTLOC= Vancouver, BC 49 19 N 123 05 W -8 Y X#PTLOC= Washington, DC 38 54 N 77 02 W -5 Y X X#PTLOC= Makkah, S. Arabia 21 25 N 39 49 E +3 N X#PTLOC= Maddinah, S. Arabia 24 30 N 39 35 E +3 N X#PTLOC= Al-Quds, Palestine 31 47 N 35 13 E +2 Y X X#PTLOC= Alexandria, Egypt 31 13 N 29 55 E +2 Y X#PTLOC= Algiers, Algeria 36 48 N 03 00 E +1 N X#PTLOC= Baghdad, `Iraq 33 20 N 44 26 E +3 N X#PTLOC= Beirut, Lebanon 33 52 N 35 30 E +3 N X#PTLOC= Cairo, Egypt 30 03 N 31 15 E +2 Y X#PTLOC= Damascus, Syria 33 30 N 36 19 E +2 N X#PTLOC= Khartoum, Sudan 15 30 N 32 36 E +2 N X#PTLOC= Rabat, Morocco 34 02 N 06 51 W +0 N X#PTLOC= Riyadh, S. Arabia 24 39 N 46 46 E +3 N X X#PTLOC= Agra, India 27 12 N 77 54 E +5 N X#PTLOC= Dacca, Bangladesh 23 48 N 90 27 E +6 N X#PTLOC= Istanbul, Turkey 41 02 N 28 57 E +2 N X#PTLOC= Jakarta, Indonesia 06 08 S 106 45 E +7 N X#PTLOC= Peshawar, Pakistan 34 01 N 71 40 E +5 N X#PTLOC= Tehran, Iran 35 40 N 51 26 E +3 N X X#PTLOC= Dar el-Salaam, Tanz. 06 48 S 39 12 E +3 N X#PTLOC= Dakar, Senegal 14 42 N 17 30 W +0 N X#PTLOC= Lagos, Nigeria 06 30 N 03 24 E +1 N X#PTLOC= Capetown, S. Africa 33 48 S 18 36 E +2 N X#PTLOC= Moscow, Russia 55 45 N 37 42 E +2 N X X#PTLOC= Tokyo, Japan 35 40 N 139 45 E +9 N X#PTLOC= Sydney, Australia 33 53 S 151 10 E +10 N X X#PTLOC= Paris, France 48 52 N 02 20 E +1 N X#PTLOC= London, England 51 30 N 00 10 W +0 N X X#PTLOC= Buenos Aires, Argant. 34 42 S 58 24 W -3 N X#PTLOC= Lima, Peru 12 24 S 77 00 W -5 N X#PTLOC= Rio DeJeneiro, Brazil 22 54 S 43 12 W -3 N X X#CC= gcc XCFLAGS= -I..\hdate -DPTLOC=\""$(PTLOC)"\" -W4 X Xpraytime.exe: praytime.c hconv.obj X $(CC) $(CFLAGS) -o praytime praytime.c hconv.obj X Xhconv.obj: ..\hdate\hconv.c ..\hdate\hconv.h X $(CC) $(CFLAGS) -c ..\hdate\hconv.c X Xclean: X -del praytime.obj X -del praytime.exe END_OF_FILE if test 5090 -ne `wc -c <'ITimer21/praytime/makefile.msc'`; then echo shar: \"'ITimer21/praytime/makefile.msc'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/makefile.msc' fi if test -f 'ITimer21/praytime/praytime.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/praytime.1'\" else echo shar: Extracting \"'ITimer21/praytime/praytime.1'\" \(6312 characters\) sed "s/^X//" >'ITimer21/praytime/praytime.1' <<'END_OF_FILE' X.TH PRAYTIME 1L "Praytime Version 2.1" X.SH NAME Xpraytime \- produce Islamic prayer time schedule X.SH SYNOPSIS X\fBpraytime\fR [\fB-h\fP] [\fB-i\fR] [\fB-f\fR \fIfiqh\fR] [\fB-r\fR \fIratio\fR] [\fB-a\fR \fIangle\fR] [\fB-t\fR \fItime\fR] [\fB-m\fR \fItime\fR] [ [\|\fImonth\fR\|] \fIyear\fR ] X.SH DESCRIPTION X\fIpraytime\fR generates Islamic prayer time schedules and computes Xthe direction of the Qiblah for any location. If no argument is given, Xthe prayer time schedule for the current date at the default location Xis produced. (The default location is the location specified by Xappropriately setting the \fBPTLOC\fP environment Xvariable (see below). If \fBPTLOC\fP is not set, the location Xconfigured into the program when it was compiled is used.) XIf a year is specified, the program outputs a Xschedule for the entire year. If a month is also specified, a Xschedule just for that month is printed. If the X.B \-h Xoption is specified, \fIpraytime\fP takes the given month/year as a Hijri Xmonth/year (see \fIHdate/Hcal\fP (1L)) and produces a schedule accordingly. X.PP XThe X.I year Xcan be between 1900 and 2200, or 0 for a "perpetual" schedule. X(Hijri year can be between 1318 and 1625.) The X.I month Xis a number between 1 and 12. Times in a "perpetual" schedules are Xessentially the average for the four years of a leap cycle. (The yearly Xvariation in prayer times is seldom more than two minutes, and the times Xreturn back to almost the same value every four years.) X.sp X.PP X\fIpraytime\fR allows for \fIFiqhi\fR variations in computing Xmethods. The following command line options affect the method of Xcomputation. X.TP 9 X\fB-f\fR \fIfiqh\fR XFiqh should be S(Hafi'i) or H(anafi). Sets the shadow ratio for Xdetermining 'Asr to 1 or 2, respectively. Default value is SHafi'i. X.TP X\fB-r\fR \fIratio\fR XSpecifies the value of the 'Asr shadow ratio explicitly. Default value is 1. X.TP X\fB-a\fR \fIangle\fR XSpecifies Sun's angle of depression at Fajr in degrees. Common values are X18 (for Fajr to be the same as the astronomical twilight) or 15 (a bit later). XDefault value is 18, which many hold to be the correct value and which Xis also the value adopted by most Islamic countries today. In North America, Xthe practice has been to use a depression angle of 15. However, in general, Xextreme care should be employed in this regard and very reliable observational Xdata should be required to accept any value which is less than 18 degrees. XThe morning twilight marks the beginning of the fasting period in XRamaDHaan, and as such, using smaller values for the depression angle Xmay even nullify the Fast. X.TP X\fB-m\fR \fItime\fR XSpecifies a maximum time interval from Fajr to sunrise in minutes. A common Xvalue used is 90 minutes. This method is sometimes used in high-latitude Xlocations where times for the usual values of Sun's depression are Xundefined or are impractical for certain days during the year. X.TP X\fB-t\fR \fItime\fR XSpecifies a fixed time interval from Fajr to sunrise in minutes. This Xvalue is used to compute daily time for Fajr prayers. A common value used Xis 90 minutes. This method is sometimes useful in extremely high-latitude Xlocations where times for the usual values of Sun's depression are either Xundefined or are impractical. X.PP XNote: 'Isha is computed symmetrically with respect to Fajr, with whichever Xmethod is chosen and whatever parameter value is specified. It is an error Xto specify at the same time both \fB-a\fR and \fB-t\fR or both \fB-t\fR and X\fB-m\fR or both \fB-f\fR and \fB-r\fR. X.sp X.PP XTo generate schedules for locations other than the location configured Xinto the program, set the PTLOC environment variable appropriately X(in your .login file under UNIX or autoexec.bat under DOS) or Xuse the following command line option. X.TP 9 X\fB-i\fR Xreads name and geographical data for the location from the standard Xinput, instead of using the default location. If Xstandard input is a (terminal) keyboard, X\fIpraytime\fR prompts the user for the values. X.SH LOCATION DATA XData supplied through the environment variable PTLOC or via standard input Xmust contain (in given order): X.RS X.PP XName of location (up to 40 characters) X.PP XLatitude degrees and minutes, and N or S to specify north or south. X.PP XLongitude degrees and minutes, and E or W to specify east or west. X.PP XTime Zone in hours (Decimal for fractional hour zones, negative if XWest of Greenwich). X.PP XY or 1 if Daylight Saving Time adjustment needed. N or 0, otherwise. X.RE X.PP XData items should be separated by whitespace. Input may contain data Xfor more than one location; the tables will be concatenated on the output. X.SH EXAMPLES XThe following example produces a prayer time schedule for August 1994. X.RS X.sp Xpraytime 8 1994 X.RE X.PP XThe following command produces a schedule for RamaDhaan 1414. X.RS X.sp Xpraytime -h 9 1414 X.RE X.PP XThe following command produces a schedule for the year 1994, using Xthe value 15 for the sun's the angle of depression. X.RS X.sp Xpraytime -a 15 1994 X.RE X.PP XThe following command sequence produces a schedule for the year 1994 Xfor Washington, DC. X.RS X.sp XIf need be, set the PTLOC environment variable X.nf XUNIX: X setenv PTLOC "Washington, DC 38 54 N 77 2 W -5 Y" XDOS: X SET PTLOC=Washington, DC 38 54 N 77 2 W -5 Y X XUNIX/DOS: X praytime 1994 X.fi X.sp X.RE X.PP XThe following command sequence on produces a perpetual prayer Xschedule for Washington, DC, using the sun's depression angle of 15 degrees Xto define Fajr and a shadow ratio of 2 to define 'Asr. The schedule includes Xadjustment for Daylight Saving Time. X.RS X.sp X.nf XUNIX: X cat > dc.dta X Washington, DC 38 54 N 77 2 W -5 Y X ^D X XDOS: X more > dc.dta X Washington, DC 38 54 N 77 2 W -5 Y X ^Z X XUNIX/DOS: X praytime -i -a15 -r 2 0 < dc.dta X.RE X.sp 1 X.SH SEE ALSO Xhdate/hcal (1L), premind(1L) X.SH AUTHORS XOriginal program, called `praytimer', produced time schedules in TeX and Xwas derived by Kamal Abdali from his \fIMinaret\fR program for the XMacintosh. Waleed Muhanna (wmuhanna@magnus.acs.ohio-state.edu) modified Xthe program to remove all TeX related code; to improve input checking, Xto allow a default location to be easily configured in; to permit the Xuser to print a schedule for the current date or a specified month and year; Xand to integrate it with hdate/hcal. END_OF_FILE if test 6312 -ne `wc -c <'ITimer21/praytime/praytime.1'`; then echo shar: \"'ITimer21/praytime/praytime.1'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/praytime.1' fi if test -f 'ITimer21/praytime/praytime.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/praytime.c'\" else echo shar: Extracting \"'ITimer21/praytime/praytime.c'\" \(28304 characters\) sed "s/^X//" >'ITimer21/praytime/praytime.c' <<'END_OF_FILE' X/* praytime.c (Version 2.1) X * X * Program to compute Islamic prayer hour schedules. X * This program is a modified version of Kamal Abdali's "praytimer" X * which produces TeX code for the schedule on the standard output. X * "praytimer" includes the following notice: X * X * Copyright (c) 1987--1992 Kamal Abdali X * X * Permission for nonprofit use of this software and its documentation X * is hereby granted without fee, provided that the above copyright notice X * appear in all copies and that both that copyright notice and this X * permission notice appear in supporting documentation, and that the name X * of Kamal Abdali not be used in advertising or publicity pertaining to X * distribution of the software without specific, written prior permission. X * X * X * Modified by Waleed A. Muhanna (wmuhanna@magnus.acs.ohio-state.edu) to X * improve input checking, remove all TeX related stuff, allow a default X * location to be easily configured in, and permit the user to print a X * schedule for the current date or a specified month and year. X * X * Please send any comments/suggestions/fixes/additions to X * wmuhanna@magnus.acs.ohio-state.edu X * X */ X X#include X#include X#include X#include X#include X#include "hconv.h" X X/* X * The program generates Islamic prayer time schedules for any X * location. If no argument is given, the prayer time schedule X * for the current date at the current (configured) location is X * produced. If a year is specified, the program outputs a schedule X * for the entire year. The year can be between 1900 and 2200, or 0 X * for a "perpetual" schedule. If a month is also specified, a schedule X * just for that month is printed. X * X * The following command line arguments control the calculation method: X * X * -a angle Sun's angle of depression at Fajr in degrees (usually 18) X * -t time Time interval from Fajr to sunrise in minutes (usually 90) X * -f fiqh Value should be S(hafii) or H(anafi) X * -r ratio Shadow ratio at Asr. (Usually 1 for SHafii, 2 for others) X * X * NOTE: It is an error to specify both -a and -t or both -f and -r. X * DEFAULT is as if called with "-a 18 -r 1" X * X * To generate schedules for locations other than the default (configured) X * location, the following command line option should be indicated. X * X * -i reads name and geographical data for the location from X * the standard input, instead of using the default (configured) X * location. If standard input is a terminal, the program X * prompts the user for the values. X * X * Data on standard input must contain (in given order) X * Name of location (upto 40 caharacters) X * Latitude degrees and minutes, and N or S to specify north or south X * Longitude degrees and minutes, and E or W to specify east or west X * Time Zone in hours (Decimal for fractional hour zones, negative if X * West of Greenwich) X * Y or 1 if Daylight Saving Time adjustment needed. N or 0, otherwise. X * X * Data items should be separated by whitespace, but the name must be on X * a separate line by itself because it may contain spaces or punctuation. X * X * Input may contain data for more than one location. X * An interactive session may be ended by typing the End-of-File character X * (e.g. CTRL-D in UNIX) when prompted for Name. X */ X X X#ifndef PTLOC X#define PTLOC "Makkah Al-Mukarramah 21 25 N 39 49 E 3 N" X#endif X X X#define MAXNAMEL 40 X#define DPR (57.29577951308230876799)/* degree per radian (180/pi) */ X#define RPD (0.01745329251994329577) /* radians per degree (pi/180) */ X#define HPR (3.81971863420548805845) /* hours per radian (12/pi) */ X#define FABS(a) ((a) > 0 ? (a) : -(a)) X#define FMOD(a,b) ((a) - floor( (a)/(b) ) * (b)) X#define MAXENV 9 X Xshort getData(/* short interactive */); Xint parseline(/* char* line, argv*/); Xvoid makeSchedule (/* void */); X Xvoid computeHours(/* short first, short last */); Xvoid computeConstants(/* short year */); Xdouble qibla(/* void */); Xdouble noontime(/* short nday, double* coaltn */); Xdouble tempus(/* short nday, double coalt, double time0 */); Xvoid dayLight(/* short* leap, short hasDayLt, X short* begin, short* finish */); X Xvoid usage(/* void */); Xvoid derror(/* char *s */); Xvoid header(/* void */); Xvoid display(/* short first, short last, short startdate */); X Xdouble deg2rad(/* double degree */); Xdouble dm2deg(/* short degree, short minute */); Xdouble dms2deg(/* long degree, short min, double sec */); Xvoid deg2dm(/* double degree, short* deg, short* min */); Xdouble hms2h(/* short hour, short min, double sec */); X Xchar *progname, *msname[12]= { X "J A N U A R Y", "F E B R U A R Y", "M A R C H", "A P R I L", X "M A Y", "J U N E", "J U L Y", "A U G U S T", "S E P T E M B E R", X "O C T O B E R", "N O V E M B E R", "D E C E M B E R" }; Xchar *dowl[]= { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; X Xchar dir[4] = {'E', 'W', 'N', 'S'}; Xshort leap, beginDayLight, endDayLight; Xshort latd, latm, longd, longm, latIsS, longIsW, X fajrByInterval, fajrByMaxInterval; Xfloat tim[366][8]; Xdouble asrShadowRatio, fajrInterval, fajrDepr; Xdouble cosobl, sinobl, perigee, dmanom, anom0; Xdouble c1, c2, delsid, sidtm0; Xchar *envv, *enva[MAXENV]; Xshort EnvDef =0; XSDATE hd; X Xchar ptlocv[] = PTLOC; Xchar name[MAXNAMEL+2]; Xdouble latitude, longitude, timeZone; Xshort hasDayLt; Xshort hflag=0; Xint stdow; X X Xmain(argc, argv) X int argc; X char *argv[]; X{ X register char *cp; X short optA = 0, optF = 0, optR = 0, optT = 0, optM = 0, X inputgdata = 0, interactive =0; X short day=0, month=0, year; X char fiqh = 'S'; X double ratio = 1.0, depr = 18.0, intvl = 90.0; X char longc, latc, dlc; X X extern double atof(/* const char* s */); X extern time_t time(); X struct tm *tm; X time_t t; X X fajrByMaxInterval = 0; fajrByInterval = 0; fajrInterval = 1.5; X fajrDepr = 18.0; asrShadowRatio = 1.0; X X progname = *argv++; argc--; X while(argc>0 && **argv == '-') { X cp = *argv +1; X switch(*cp++) { X case 'i': /* Input Geographic Data */ X inputgdata = 1; X break; X case 'a': /* Sun's depression angle at Fajr X in degrees */ X if (*cp=='\0') X if (argc>1) { X cp = *++argv; argc--; X } else usage(); X depr = atof(cp); optA = 1; X break; X case 't': /* Fixed time interval from Fajr to X Sunrise */ X if (*cp=='\0') X if (argc>1) { X cp = *++argv; argc--; X } else usage(); X intvl = atof(cp); optT = 1; X break; X case 'm': /* Maximum time interval from Fajr to X Sunrise */ X if (*cp=='\0') X if (argc>1) { X cp = *++argv; argc--; X } else usage(); X intvl = atof(cp); optM = 1; X break; X case 'r': /* Shadow ratio at 'Asr */ X if (*cp=='\0') X if (argc>1) { X cp = *++argv; argc--; X } else usage(); X ratio = atof(cp); optR = 1; X break; X case 'f': /* Fiqh for 'Asr. Value to be X H(anafi) or S(hafii) */ X if (*cp) fiqh = *cp; X else if (argc>1) { X fiqh = **++argv; --argc; X } else usage(); X if (fiqh != 'H' && fiqh != 'S') { X fprintf(stderr, "%s: command \ Xline arg -f must have value H(anafi) or S(hafii)\n", progname); X usage(); X } X /* Set 'Asr shadow ratio according to X the chosen fiqh: 1 for S, 2 for H */ X ratio = (fiqh == 'S' ? 1.0 : 2.0); X optF = 1; X break; X case 'h': /* Hijri dates */ X hflag++; X break; X default: X usage(); X X } X argc--, argv++; X } X if (optF && optR) { X fprintf(stderr, "%s: invalid command line arg combination (can't have both -f and -r)\n", progname); X usage(); X } X if (optF || optR) asrShadowRatio = ratio; X if (optA && optT) { X fprintf(stderr, "%s: invalid command line arg combination (can't have both -a and -t)\n", progname); X usage(); X } X if (optM && optT) { X fprintf(stderr, "%s: invalid command line arg combination (can't have both -m and -t)\n", progname); X usage(); X } X if (intvl<=0) { X fprintf(stderr, "%s: invalid Fajr time interval specified.\n", X progname); X usage(); X } X if (optT) { X fajrByInterval = 1; fajrInterval = intvl/60.0; X } X if (optM) { X fajrByMaxInterval = 1; fajrInterval = intvl/60.0; X } X if (optA) { X fajrByInterval = 0; fajrDepr = depr; X } X X if (argc == 0) { X t = time((time_t *)0); X tm = localtime(&t); X day = tm->tm_mday; X month = tm->tm_mon+1; X year = 1900 + tm->tm_year; X if (hflag) hd = *hdate(year,month,day); X } else if (argc <= 2) { X if (argc==2) { X month = atoi(argv[0]); X if (month<=0 || month>12) usage(); X year = atoi(argv[1]); X } else { X if (!isdigit(*argv[0])) usage(); X year = atoi(argv[0]); X } X if (hflag !=0) { X if (year < 1318 || year > 1625) usage(); X } else X if (year != 0 && (year < 1900 || year > 2200)) usage(); X } else usage(); X X if (inputgdata) { X interactive = isatty(fileno(stdin)); X while (getData(interactive)) makeSchedule(day,month,year); X } else { X /* get values from the environment var (if defined) */ X X if ((envv = getenv("PTLOC")) != NULL) X EnvDef = 1; X else X envv = ptlocv; X X if (parseline(envv, enva, MAXENV) != MAXENV) X derror("parameter(s) missing."); X X strncpy(name, enva[0], MAXNAMEL); X latd = atoi(enva[1]); latm = atoi(enva[2]); X latc = enva[3][0]; X if (latd<0 || latd>90 || latm<0 || latm>59 || X (latc != 'N' && latc != 'n' && latc != 'S' && latc != 's')) X derror("Illegal data for geographical latitude!"); X latIsS = latc == 'S' || latc == 's'; X X longd = atoi(enva[4]); longm = atoi(enva[5]); X longc = enva[6][0]; X if (longd<0 || longd>180 || longm<0 || longm > 59 || X (longc != 'E' && longc != 'e' && longc != 'W' && longc != 'w')) X derror("Illegal data for geographical longitude!"); X longIsW = longc == 'W' || longc == 'w'; X X timeZone = atof(enva[7]); X if (timeZone <= -12.0 || timeZone > 12.0) X derror("Illegal data for time zone!"); X X dlc = enva[8][0]; X if (dlc != 'Y' && dlc != 'y' && dlc != 'N' && dlc != 'n' && X dlc != '1' && dlc != '0') X derror("Illegal data for daylight saving time!"); X hasDayLt = dlc == 'Y' || dlc == 'y' || dlc == '1'; X X X latitude = deg2rad(dm2deg(latd,latm)); X if (latIsS) latitude = - latitude; X longitude = deg2rad(dm2deg(longd,longm)); X if (!longIsW) longitude = - longitude; X X makeSchedule(day,month,year); X X }; X exit(0); X} X Xvoid usage() X{ X fprintf(stderr, "Usage: %s [-i] [-f fiqh] [-r ratio] [-a angle] \ X[-t time] [-m time] [-h] [[month] year]\n", progname); X exit(1); X} X X Xvoid derror(s) Xchar *s; X{ X if (EnvDef) X fprintf(stderr, "Invalid PTLOC environment variable.\n"); X else X fprintf(stderr, X "Invalid PTLOC configuration variable compiled in.\n"); X fprintf(stderr, "%s\n", s); X exit(1); X} X Xint parseline(line, argv, maxargv) Xchar *line; Xchar *argv[]; Xint maxargv; X{ X int argc=0; X char ch; X X while (argc '9')) X line++; line--; X } else X while ((ch = *line) != '\0' && ch != ' ' && ch != '\t') X line++; X if (ch == '\0') break; X *line = '\0'; line++; X } X return(argc); X} X X X X/* X * Obtain name and geographical data for the location for which X * the schedule is desired. If INTERACTIVE is true, then X * the user is prompted for the info at the terminal. X * Otherwise, the info is obtained from the standard input. X * Note: time data and values to control the calculation method are X * to be given as command line arguments, not as input. X */ X Xshort getData(interactive) X short interactive; X{ X short maxNameLength, chCount, badData; X char str[82]; X int ch; X X maxNameLength = MAXNAMEL; X if (interactive) /* Data to be read from terminal */ X fprintf(stderr, "Location name (%2d chars or less)? ", X maxNameLength); X chCount = 0; X /* Read Name. First skip over leading whitespaces */ X while ((ch = getchar()) != EOF && X (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')); X if (ch == EOF) return(0); X name[chCount++] = ch; X while (--maxNameLength > 0 && (ch = getchar()) != EOF X && ch != '\n' && (ch < '0' || ch > '9')) name[chCount++] = ch; X if (ch >= '0' && ch <= '9') ungetc(ch, stdin); X name[chCount++] = '\0'; X do { X if (interactive) X fprintf(stderr, "Latitude (degrees minutes N/S)? "); X badData = scanf("%hd", &latd) !=1 || scanf("%hd", &latm)!=1; X if (scanf("%s", str) == EOF) return(0); ch = str[0]; X badData = badData || latd<0 || latd>90 || latm<0 || latm>59 || X (ch != 'N' && ch != 'n' && ch != 'S' && ch != 's'); X if (badData) { X fprintf(stderr, "Illegal data for geographical latitude!\n"); X if (!interactive) return(0); X } X } while (badData); X latIsS = ch == 'S' || ch == 's'; X do { X if (interactive) X fprintf(stderr, "Longitude (degrees minutes E/W)? "); X badData = scanf("%hd", &longd) !=1 || scanf("%hd", &longm)!=1; X if (scanf("%s", str) == EOF) return(0); ch = str[0]; X badData = badData || longd<0 || longd>180 || longm<0 || X longm > 59 || X (ch != 'E' && ch != 'e' && ch != 'W' && ch != 'w'); X if (badData) { X fprintf(stderr, "Illegal data for geographical longitude!\n"); X if (!interactive) return(0); X } X } while (badData); X longIsW = ch == 'W' || ch == 'w'; X do { X if (interactive) X fprintf(stderr, X "Time Zone in hours (negative if West of Greenwich)? "); X if (badData = (scanf("%lf", &timeZone) != 1 || X timeZone <= -12.0 || timeZone > 12.0)) { X fprintf(stderr, "Illegal data for time zone!\n"); X if (!interactive) return(0); X } X } while (badData); X do { X if (interactive) fprintf(stderr, "Adjust for daylight saving time (Y/N)? "); X while ((ch = getchar()) != EOF && X (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')); X if (ch == EOF) return(0); X if (badData = (ch != 'Y' && ch != 'y' && X ch != 'N' && ch != 'n' && X ch != '1' && ch != '0')) { X fprintf(stderr, "Illegal data for daylight saving time!\n"); X if (!interactive) return(0); X } X } while (badData); X hasDayLt = ch == 'Y' || ch == 'y' || ch == '1'; X X latitude = deg2rad(dm2deg(latd,latm)); X if (latIsS) latitude = - latitude; X longitude = deg2rad(dm2deg(longd,longm)); X if (!longIsW) longitude = - longitude; X return(1); X} X X/* X * Computes day number (first is 0) in the year. X*/ Xshort daynum(d,m,y) X short d,m,y; X{ X register short i, dn; X X i=1; dn= --d; X while (i59 && year==0) k = l-1; X tim[l][2] = noontime(k+1,&coaltn); X coalt[3] = atan(asrShadowRatio+tan(coaltn)); X time0[1] = (((tim[l][1] = t = tempus(k+1,coalt[1],time0[1])) X < 24.0) ? t : 6.0); X time0[3] = (((tim[l][3] = t = tempus(k+1,coalt[3],time0[3])) X < 24.0) ? t : 15.0); X time0[4] = (((tim[l][4] = t = tempus(k+1,coalt[4],time0[4])) X < 24.0) ? t : 18.0); X if (fajrByInterval) { X tim[l][0] = time0[0] = time0[1] - fajrInterval; X tim[l][5] = time0[5] = time0[4] + fajrInterval; X } else { X time0[0] = (((tim[l][0] = t = tempus(k+1,coalt[0],time0[0])) X < 24.0) ? t : 4.0); X time0[5] = (((tim[l][5] = t = tempus(k+1,coalt[5],time0[5])) X < 24.0) ? t : 20.0); X } X } X/* correct for daylight saving time (if necessary) */ X if (endDayLight !=0 && firsti) i=first; X while (i noct31 ) *finish -= 7; X *finish = *finish-1; X} X X/* X * Place sun's coaltitude at noon in coaltn, X * and return time of noon for day no. nday of year X */ X Xdouble noontime(nday, coaltn) X short nday; X double* coaltn; X{ X/* slong = sun's true longitude at noon */ X/* ra = sun's right ascension, decl = sun's declination */ X/* ha = sun's hour angle west */ X/* locmt = local mean time of phenomenon */ X X register double t; X double longh,days,anomaly,slong,sinslong,ra,decl,locmt; X X longh = longitude*HPR; X days = nday+(12.0+longh)/24.0; X anomaly = anom0+dmanom*days; X slong = perigee+anomaly+c1*sin(anomaly)+c2*sin(anomaly*2); X sinslong = sin(slong); X ra = atan2(cosobl*sinslong,cos(slong))*HPR; X if (ra<0.0) ra += 24.0; X decl = asin(sinobl*sinslong); X locmt = ra-delsid*days-sidtm0; X t = locmt+longh+timeZone; X if (t<0.0) t += 24.0; X if (t>24.0) t -= 24.0; X *coaltn = FABS(latitude-decl); X return(t); X} X X/* X * Returns time on day no. nday of year when sun's coaltitude is coalt. X * If no such time, then returns a large number. X * time0 is approximate time of phenomenon X */ X Xdouble tempus(nday, coalt, time0) X short nday; X double coalt; X double time0; X{ X/* slong = true longitude */ X/* ra = sun's right ascension, sindcl = sin(sun's declination) */ X/* ha = sun's hour angle west */ X/* locmt = local mean time of phenomenon */ X X double longh,days,anomaly,slong,sinslong,ra,sindcl,cosha,ha,locmt; X register double t; X X longh = longitude*HPR; X days = nday+(time0+longh)/24.0; X anomaly = anom0+dmanom*days; X slong = perigee+anomaly+c1*sin(anomaly)+c2*sin(anomaly*2); X sinslong = sin(slong); X ra = atan2(cosobl*sinslong,cos(slong))*HPR; X if (ra<0.0) ra += 24.0; X sindcl = sinobl*sinslong; X cosha = (cos(coalt)-sindcl*sin(latitude))/ X (sqrt(1.0-sindcl*sindcl)*cos(latitude)); X /* if cos(ha)>1, then time cannot be evaluated */ X if (FABS(cosha)>1.0) return(1.0e7); X ha = acos(cosha)*HPR; X if (time0<12.0) ha = 24.0-ha; X locmt = ha+ra-delsid*days-sidtm0; X t = locmt+longh+timeZone; X if (t<0.0) t += 24.0; X if (t>24.0) t -= 24.0; X return(t); X} X X/* X * Returns the direction of qibla in radians. Eastward from north is positive. X */ X Xdouble qibla() X{ X X /* lat0, long0 are Makkah's latitude and longitude in radians */ X double lat0 = 0.3739077, long0 = -0.69504828, dflong; X X dflong = longitude-long0; X return( atan2(sin(dflong), X cos(latitude)*tan(lat0)-sin(latitude)*cos(dflong)) ); X /* X cos(lat0)*tan(latitude)-sin(latitude)*cos(dflong)) ); X */ X} X X X/* X * Print title material. X */ X Xvoid header(day,month,year) Xshort day,month,year; X{ X double direc; X short qibd, qibm, zoneH, zoneM; X char sgnlat, sgnlng, sgnzon, sgnqib; X X sgnlat = (latIsS ? dir[3] : dir[2]); X sgnlng = (longIsW ? dir[1] : dir[0]); X X deg2dm(timeZone, &zoneH, &zoneM); X sgnzon = (timeZone<0 ? '-' : '+'); X X direc = qibla() * DPR; X deg2dm(direc, &qibd, &qibm); X sgnqib = (direc<0 ? dir[1] : dir[0]); X X if (day!=0) { X if (hflag) printf("Today's (%s %2d, %4d) ",hmname[hd.mon-1],hd.day, hd.year); X else printf("Today's (%s %2d, %4d) ",mname[month-1],day, year); X } else { X if (month!=0) printf("%s ", hflag==0 ? mname[month-1] : hmname[month-1]); X if (year==0) printf("Perpetual "); X else if (!hflag) printf("%4d C.E. ",year); X else printf("%4d A.H. ", year); X } X printf("Prayer Schedule for %s\n",name); X printf(" Latitude = %3d %02d' %c\t", latd,latm,sgnlat); X printf("Longitude = %3d %02d' %c\t",longd,longm,sgnlng); X printf("Zone Time = GMT %c%2dh",sgnzon,zoneH); X if (zoneM) printf("%3dm",zoneM); X printf("\n\t\tQiblah = %3d %02d' %c (From N)\n", qibd,qibm,sgnqib); X} X X/* X * Print times for range of days (in the year) first..last-1. X * Days in month range from startdate to startdate+last-first X */ X Xvoid display(first, last, startdate, cd, cm, header) X short first; X short last; X short startdate, cd, cm, header; X{ X short hour,minute; X double t; X register short i,j,l; X if (header) { X printf("\n-----------------------------------------------------------------------\n"); X printf(" Fajr SHorwwQ DHuhr `ASr MaGHrib `ISHaa'\n"); X printf("Date Day Dawn Sunrise Noon Afternoon Sunset Evening\n"); X printf("-----------------------------------------------------------------------\n"); X } X X for (l=first, i=startdate; l360.0 || t<0.0 || X (tim[l][1]-t)> fajrInterval)) X t = tim[l][1] - fajrInterval; X if (j==5 && (t>360.0 || t<0.0 || X (t-tim[l][4])> fajrInterval)) X t = tim[l][4] + fajrInterval; X } X X if (t>360.0) { X printf(" * "); X } else if (t<0.0) { X printf(" "); X } else { X /* time conversion to am and pm hours and rounded minutes */ X hour = t; minute = 60.0*(t-hour)+0.5; X if (minute>=60) { X minute = 0; X hour += 1; X } X if (hour>12) hour -= 12; X printf(" %3d:%02d",hour,minute); X } X } X if (hflag) printf(" %2d/%2d", cd++, cm); X printf("\n"); X } X X} X X X/* X * Utility functions X * X */ X Xdouble deg2rad(degree) X double degree; X{ X return(degree*RPD); X} X Xdouble dm2deg(degree, minute) X short degree; X short minute; X{ X return((double) degree + minute/60.0); X} X Xvoid deg2dm(degree, deg, min) X double degree; X short *deg; X short *min; X{ X double dabs; X dabs = FABS(degree); X *deg = dabs; X *min = 60.0*(dabs - *deg) +0.5; X if (*min>=60) { X *min = 0; X *deg += 1; X } X} X Xdouble dms2deg(degree, min, sec) X long degree; X short min; X double sec; X{ X return((double) degree + min/60.0 + sec/3600.0); X} X Xdouble hms2h(hour, min, sec) X short hour; X short min; X double sec; X{ X return((double) hour + min/60.0 + sec/3600.0); X} X END_OF_FILE if test 28304 -ne `wc -c <'ITimer21/praytime/praytime.c'`; then echo shar: \"'ITimer21/praytime/praytime.c'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/praytime.c' fi if test -f 'ITimer21/praytime/praytime.hlp' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/praytime/praytime.hlp'\" else echo shar: Extracting \"'ITimer21/praytime/praytime.hlp'\" \(6850 characters\) sed "s/^X//" >'ITimer21/praytime/praytime.hlp' <<'END_OF_FILE' X X X X PRAYTIME(1L) (Praytime Version 2.1) PRAYTIME(1L) X X X X NAME X praytime - produce Islamic prayer time schedule X X SYNOPSIS X praytime [-h] [-i] [-f fiqh] [-r ratio] [-a angle] [-t time] X [-m time] [ [month] year ] X X DESCRIPTION X praytime generates Islamic prayer time schedules and X computes the direction of the Qiblah for any location. If X no argument is given, the prayer time schedule for the X current date at the default location is produced. (The X default location is the location specified by appropriately X setting the PTLOC environment variable (see below). If X PTLOC is not set, the location configured into the program X when it was compiled is used.) If a year is specified, the X program outputs a schedule for the entire year. If a month X is also specified, a schedule just for that month is X printed. If the -h option is specified, praytime takes the X given month/year as a Hijri month/year (see Hdate/Hcal (1L)) X and produces a schedule accordingly. X X The year can be between 1900 and 2200, or 0 for a X "perpetual" schedule. (Hijri year can be between 1318 and X 1625.) The month is a number between 1 and 12. Times in a X "perpetual" schedules are essentially the average for the X four years of a leap cycle. (The yearly variation in prayer X times is seldom more than two minutes, and the times return X back to almost the same value every four years.) X X X praytime allows for Fiqhi variations in computing methods. X The following command line options affect the method of X computation. X X -f fiqh Fiqh should be S(Hafi'i) or H(anafi). Sets the X shadow ratio for determining 'Asr to 1 or 2, X respectively. Default value is SHafi'i. X X -r ratio Specifies the value of the 'Asr shadow ratio X explicitly. Default value is 1. X X -a angle Specifies Sun's angle of depression at Fajr in X degrees. Common values are 18 (for Fajr to be the X same as the astronomical twilight) or 15 (a bit X later). Default value is 18, which many hold to be X the correct value and which is also the value X adopted by most Islamic countries today. In North X America, the practice has been to use a depression X angle of 15. However, in general, extreme care X should be employed in this regard and very reliable X observational data should be required to accept any X X X X Page 1 (printed 8/22/94) X X X X X X X PRAYTIME(1L) (Praytime Version 2.1) PRAYTIME(1L) X X X X value which is less than 18 degrees. The morning X twilight marks the beginning of the fasting period X in RamaDHaan, and as such, using smaller values for X the depression angle may even nullify the Fast. X X -m time Specifies a maximum time interval from Fajr to X sunrise in minutes. A common value used is 90 X minutes. This method is sometimes used in high- X latitude locations where times for the usual values X of Sun's depression are undefined or are X impractical for certain days during the year. X X -t time Specifies a fixed time interval from Fajr to X sunrise in minutes. This value is used to compute X daily time for Fajr prayers. A common value used X is 90 minutes. This method is sometimes useful in X extremely high-latitude locations where times for X the usual values of Sun's depression are either X undefined or are impractical. X X Note: 'Isha is computed symmetrically with respect to Fajr, X with whichever method is chosen and whatever parameter value X is specified. It is an error to specify at the same time X both -a and -t or both -t and -m or both -f and -r. X X X To generate schedules for locations other than the location X configured into the program, set the PTLOC environment X variable appropriately (in your .login file under UNIX or X autoexec.bat under DOS) or use the following command line X option. X X -i reads name and geographical data for the location X from the standard input, instead of using the X default location. If standard input is a X (terminal) keyboard, praytime prompts the user for X the values. X X LOCATION DATA X Data supplied through the environment variable PTLOC or via X standard input must contain (in given order): X X Name of location (up to 40 characters) X X Latitude degrees and minutes, and N or S to specify X north or south. X X Longitude degrees and minutes, and E or W to specify X east or west. X X Time Zone in hours (Decimal for fractional hour zones, X negative if West of Greenwich). X X X X Page 2 (printed 8/22/94) X X X X X X X PRAYTIME(1L) (Praytime Version 2.1) PRAYTIME(1L) X X X X Y or 1 if Daylight Saving Time adjustment needed. N or X 0, otherwise. X X Data items should be separated by whitespace. Input may X contain data for more than one location; the tables will be X concatenated on the output. X X EXAMPLES X The following example produces a prayer time schedule for X August 1994. X X praytime 8 1994 X X The following command produces a schedule for RamaDhaan X 1414. X X praytime -h 9 1414 X X The following command produces a schedule for the year 1994, X using the value 15 for the sun's the angle of depression. X X praytime -a 15 1994 X X The following command sequence produces a schedule for the X year 1994 for Washington, DC. X X If need be, set the PTLOC environment variable X UNIX: X setenv PTLOC "Washington, DC 38 54 N 77 2 W -5 Y" X DOS: X SET PTLOC=Washington, DC 38 54 N 77 2 W -5 Y X X UNIX/DOS: X praytime 1994 X X X The following command sequence on produces a perpetual X prayer schedule for Washington, DC, using the sun's X depression angle of 15 degrees to define Fajr and a shadow X ratio of 2 to define 'Asr. The schedule includes adjustment X for Daylight Saving Time. X X UNIX: X cat > dc.dta X Washington, DC 38 54 N 77 2 W -5 Y X ^D X X DOS: X more > dc.dta X Washington, DC 38 54 N 77 2 W -5 Y X ^Z X X X X X Page 3 (printed 8/22/94) X X X X X X X PRAYTIME(1L) (Praytime Version 2.1) PRAYTIME(1L) X X X X UNIX/DOS: X praytime -i -a15 -r 2 0 < dc.dta X X X SEE ALSO X hdate/hcal (1L), premind(1L) X X AUTHORS X Original program, called `praytimer', produced time X schedules in TeX and was derived by Kamal Abdali from his X Minaret program for the Macintosh. Waleed Muhanna X (wmuhanna@magnus.acs.ohio-state.edu) modified the program to X remove all TeX related code; to improve input checking, to X allow a default location to be easily configured in; to X permit the user to print a schedule for the current date or X a specified month and year; and to integrate it with X hdate/hcal. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Page 4 (printed 8/22/94) X X X END_OF_FILE if test 6850 -ne `wc -c <'ITimer21/praytime/praytime.hlp'`; then echo shar: \"'ITimer21/praytime/praytime.hlp'\" unpacked with wrong size! fi # end of 'ITimer21/praytime/praytime.hlp' fi if test -f 'ITimer21/premind/Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/premind/Makefile'\" else echo shar: Extracting \"'ITimer21/premind/Makefile'\" \(669 characters\) sed "s/^X//" >'ITimer21/premind/Makefile' <<'END_OF_FILE' X# X# Makefile for premind X# X# Waleed A. Muhanna X# Ohio State University X# wmuhanna@magnus.acs.ohio-state.edu X# August, 1994 X# X X X# Edit the following line to give the default "praytime" command XPRAYTIME = "praytime" X XDESTDIR=/usr/local X#CC= gcc X X#normally these flags should work XCFLAGS= -O -DPRAYTIME=\"${PRAYTIME}\" X#but on BSD systems you may have to use the following instead X#CFLAGS= -O -systype sysv -DPRAYTIME=\"${PRAYTIME}\" X X Xpremind: premind.c X $(CC) $(CFLAGS) -o premind premind.c X Xinstall: premind X install -c -s premind $(DESTDIR)/bin X install -c killpr $(DESTDIR)/bin X install -c -m 444 premind.1 $(DESTDIR)/man/man1 X Xclean: X rm -f premind core premind.o END_OF_FILE if test 669 -ne `wc -c <'ITimer21/premind/Makefile'`; then echo shar: \"'ITimer21/premind/Makefile'\" unpacked with wrong size! fi # end of 'ITimer21/premind/Makefile' fi if test -f 'ITimer21/premind/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/premind/README'\" else echo shar: Extracting \"'ITimer21/premind/README'\" \(997 characters\) sed "s/^X//" >'ITimer21/premind/README' <<'END_OF_FILE' X X XThis directory contains release 2.1 of PREMIND. PREMIND provides a prayers Xtime reminder service. It is designed to work in conjunction with Xrelease 2.1 of PRAYTIME which is included in this distribtion. XPREMIND would run ONLY on machines running UNIX or its variants. X XThis directory contains the following files: X X README - this file. X premind.1 - reference manual page (nroff/troff -man). X premind.hlp - output of "nroff -man premind.1 |col -b". X Makefile - contains configuration and "make" information X premind.c - C source file for premind. X killpr - a shell script to cancel premind service X XInstalling Premind: X XPremind determines prayers times by invoking and reading the Xoutput of "praytime". You must therefore have the executable for X"praytime" present in the current working directory or installed in Xsome other directory which is in the shell search PATH. Edit Xthe Makefile (if needed) and type "make". X XRead the manual page for further instructions. X XWaleed Muhanna END_OF_FILE if test 997 -ne `wc -c <'ITimer21/premind/README'`; then echo shar: \"'ITimer21/premind/README'\" unpacked with wrong size! fi # end of 'ITimer21/premind/README' fi if test -f 'ITimer21/premind/killpr' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/premind/killpr'\" else echo shar: Extracting \"'ITimer21/premind/killpr'\" \(399 characters\) sed "s/^X//" >'ITimer21/premind/killpr' <<'END_OF_FILE' X#!/bin/sh X# killpr - kill premind processes I own X# Waleed Muhanna (wmuhanna@magnus.acs.ohio-state.edu) 12/92, 8/94 X Xset x `ps x | awk '/:[0-9][0-9] ([^ ]*\/p|p)remind( |$)/ {print $1}'`; shift Xcase $# in X 0) echo "No Premind processes found.";; X 1) kill -9 $* ; X echo "Found and terminated 1 Premind process.";; X *) kill -9 $* ; X echo "Found and terminated $# Premind processes.";; Xesac Xexit 0 END_OF_FILE if test 399 -ne `wc -c <'ITimer21/premind/killpr'`; then echo shar: \"'ITimer21/premind/killpr'\" unpacked with wrong size! fi chmod +x 'ITimer21/premind/killpr' # end of 'ITimer21/premind/killpr' fi if test -f 'ITimer21/premind/premind.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/premind/premind.1'\" else echo shar: Extracting \"'ITimer21/premind/premind.1'\" \(2020 characters\) sed "s/^X//" >'ITimer21/premind/premind.1' <<'END_OF_FILE' X.TH PREMIND 1L "premind Version 2.1" X.UC 4 X.SH NAME Xpremind, killpr \- Islamic prayers time reminder/notification service X.SH SYNOPSIS X\fBpremind\fR [\fB-d\fR \fImin\fP] [\fIptcommand\fR] X.br X\fBkillpr\fR X.SH DESCRIPTION X\fIPremind\fP waits until the next prayers' time, and then notifies/reminds Xyou that it's time for prayers. Reminder messages are sent to the initiating Xterminal 5 minutes and 1 minute before the actual time, at prayers Xtime, and one minute after. The \fB-d\fP option may be used to set Xthe advance warning time to \fImin\fP minutes, instead of the default 5 Xminutes. X.PP X\fIPremind\fP is designed to work in conjunction with \fIpraytime\fP(1L). XTo determine prayers' times, \fIpremind\fP automatically (once a day) Xexecutes, reads, and parses the output of \fIptcommand\fP, a praytime shell Xcommand given as an argument. If no argument is given, the default command X(normally configured to be "praytime") is used. X.PP XThe \fIptcommand\fP must be quoted if it contains blanks or other special Xcharacters, as illustrated by the following example commands: X.RS X.sp Xpremind "praytime -a15 -r2" X.sp Xpremind -d 10 "praytime -i 'ITimer21/premind/premind.c' <<'END_OF_FILE' X X/* premind.c - prayers time reminder/notification service v2.1 X * X * Copyright (c) 1992 by Waleed A. Muhanna X * X * Permission for nonprofit use and redistribution of this software and X * its documentation is hereby granted without fee, provided that the X * above copyright notice appear in all copies and that both that copyright X * notice and this permission notice appear in supporting documentation. X * X * No representation is made about the suitability of this software for any X * purpose. It is provided "as is" without express or implied warranty. X * X * Send any comments/suggestions/fixes/additions to: X * wmuhanna@magnus.acs.ohio-state.edu X * X */ X X#include X#include X/* X #include */ X#include X#include X#include X X#ifndef PRAYTIME X#define PRAYTIME "praytime" X#endif X Xstatic char *ptcmd = PRAYTIME; Xstatic char *progname, *pname[5] = { X "Fajr (dawn)", "DHuhr (noon)", "`ASir (afternoon)", X "MaGHrib (sunset)", "`ISHaa' (evening)"}; X Xstatic long ptime[5]; Xstatic int dmin = 5, firsttime = 1; Xstatic unsigned int dsec; X X Xmain(argc, argv) X int argc; X char *argv[]; X{ X register char c, *cp; X void usage(), gettimes(), doit(); X X progname = *argv++; argc--; X X if (argc>0 && **argv == '-') { X cp = *argv +1; X if (*cp++ =='d') { X if (*cp=='\0') X if (argc>1) { X cp = *++argv; argc--; X } else usage(); X for (dmin = 0; (c = *cp); ++cp) { X if (!isdigit(c)) usage(); X dmin = dmin * 10 + (c - '0'); X } X } else usage(); X argc--; argv++; X } X X if (argc != 0) X if (argc == 1) ptcmd = *argv; else usage(); X X dsec = dmin * 60; X X X while (1) { X gettimes(); X doit(); X } X} X X Xvoid Xusage() X{ X fprintf(stderr, "Usage: %s [-d min] [ptcommand]\n", progname); X exit(1); X} X Xvoid Xgettimes() X{ X FILE *fin; X char buf[82]; X int hf, mf, hn, mn, ha, ma, hm, mm, he, me, i=0; X extern int strncmp(); X X if ((fin = popen(ptcmd, "r")) == NULL) { X fprintf(stderr, "%s: can't find/run %s\n", progname, ptcmd); X exit(1); X } X X while (fgets(buf, sizeof buf, fin) != NULL) { X if (firsttime) fprintf(stderr,"%s", buf); X if (++i>9) break; /*can't go on forever*/ X if (strncmp(buf,"Date", 4) == 0) { X /*skip --- line */ X if (fgets(buf, sizeof buf, fin) != NULL) X if (firsttime) fprintf(stderr,"%s\n", buf); X /* get today's data */ X if (fgets(buf, sizeof buf, fin) != NULL) { X pclose(fin); X if (sscanf(buf, X "%*d %*s %d:%d %*d:%*d %d:%d %d:%d %d:%d %d:%d", X &hf, &mf, &hn, &mn, &ha, &ma, &hm, X &mm, &he, &me) != 10) break; X if (firsttime) fprintf(stderr,"%s\n", buf); X if (hn<5) hn +=12; X ha +=12; hm +=12; he +=12; X ptime[0] = (hf*60+mf)*60; X ptime[1] = (hn*60+mn)*60; X ptime[2] = (ha*60+ma)*60; X ptime[3] = (hm*60+mm)*60; X ptime[4] = (he*60+me)*60; X return; X } else break; X } X } X X fprintf(stderr, "%s: output format of %s unrecognized!\n", X progname, ptcmd); X exit(1); X} X X Xvoid Xcsleep(secs) X unsigned int secs; X{ X struct stat buf; X unsigned int twohrs = 7200; X X while (secs>twohrs) { X (void)sleep(twohrs); X if (fstat(2,&buf)!=0) exit(0); X secs -= twohrs; X } X (void)sleep(secs); X} X X X#define ONEMIN 60 X Xvoid Xdoit() X{ X struct tm *t; X time_t now; X long tnow; X int pid, i; X void dopremind(); X X now = time((time_t *)0); t = localtime(&now); X tnow = (t->tm_hour*60L + t->tm_min)*60L + t->tm_sec; X X for (i=0; i<5; i++) X if (ptime[i]>tnow) { X dopremind((unsigned int)(ptime[i]-tnow), i); X tnow = ptime[i]+ONEMIN; X } X X if (firsttime) { X firsttime--; X if (pid = fork()) { X fprintf(stderr, X "Next prayer reminder set for Fajr (dawn) tomorrow. (pid %d)\n", X pid); X exit(0); X } X } X X /* go to sleep until 2:02 the next morning */ X csleep((unsigned int)(93720L - tnow)); X} X X X Xvoid Xdopremind(secs, pi) X unsigned int secs; X int pi; X{ X int pid, i; X time_t tup; X X if (firsttime) { X firsttime--; X fprintf(stderr,"Next prayer reminder set for %s on ", X pname[pi]); X if (pid = fork()) { X (void)time(&tup); X tup += secs; X fprintf(stderr,"%.16s. (pid %d)\n", ctime(&tup), pid); X exit(0); X } X (void)sleep((unsigned int)2); X } X X /* if write fails, we've lost the terminal (a la BSD command leave). */ X X#define MSG1 "minutes.\n" X if (dsec !=0 && secs >= dsec) { X csleep(secs - dsec); X fprintf(stderr, "\07\07%s Prayers in %d ", pname[pi], dmin); X if (write(2, MSG1, sizeof(MSG1) - 1) != sizeof(MSG1) - 1) X exit(0); X secs = dsec; X } X X#define MSG2 "\07\07Just one more minute till prayers' time!\n" X if (secs > ONEMIN) { X (void)sleep(secs - ONEMIN); X if (write(2, MSG2, sizeof(MSG2) - 1) != sizeof(MSG2) - 1) X exit(0); X secs = ONEMIN; X } X X (void)sleep(secs); X X#define MSG3 "\07\07Time for" X for (i=2; i--;) { X if (i) { X (void)time(&tup); X fprintf(stderr, "It is now %.16s; ", ctime(&tup)); X } else { X (void)sleep((unsigned int)ONEMIN); X fprintf(stderr, "You're late; "); X } X X if (write(2, MSG3, sizeof(MSG3) - 1) != sizeof(MSG3) - 1) X exit(0); X fprintf(stderr," %s Prayers!\n", pname[pi]); X } X} END_OF_FILE if test 5065 -ne `wc -c <'ITimer21/premind/premind.c'`; then echo shar: \"'ITimer21/premind/premind.c'\" unpacked with wrong size! fi # end of 'ITimer21/premind/premind.c' fi if test -f 'ITimer21/premind/premind.hlp' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ITimer21/premind/premind.hlp'\" else echo shar: Extracting \"'ITimer21/premind/premind.hlp'\" \(2054 characters\) sed "s/^X//" >'ITimer21/premind/premind.hlp' <<'END_OF_FILE' X X X X PREMIND(1L) (premind Version 2.1) PREMIND(1L) X X X X NAME X premind, killpr - Islamic prayers time reminder/notification X service X X SYNOPSIS X premind [-d min] [ptcommand] X killpr X X DESCRIPTION X Premind waits until the next prayers' time, and then X notifies/reminds you that it's time for prayers. Reminder X messages are sent to the initiating terminal 5 minutes and 1 X minute before the actual time, at prayers time, and one X minute after. The -d option may be used to set the advance X warning time to min minutes, instead of the default 5 X minutes. X X Premind is designed to work in conjunction with X praytime(1L). To determine prayers' times, premind X automatically (once a day) executes, reads, and parses the X output of ptcommand, a praytime shell command given as an X argument. If no argument is given, the default command X (normally configured to be "praytime") is used. X X The ptcommand must be quoted if it contains blanks or other X special characters, as illustrated by the following example X commands: X X premind "praytime -a15 -r2" X X premind -d 10 "praytime -i -->