[soc.religion.islam] Prayer Time-Table PROGRAM Ver-2

cnar08@vaxa.strath.ac.uk (04/11/91)

----------------- program starts below ---------------


C-------------------------------------------------------------
C
C       PRAYER TIME TABLE
C       =================
C
C       THIS FORTRAN VERSION IS ADOPTED FROM THE BASIC VERSION
C       ORIGINALLY PROGRAMMED BY T. DJAMALUDDIN
C           Dept. of astronomy, kyoto university
C           Sakyo-ku, kyoto 606, japan
C
C
C-------------------------------------------------------------
C
C
C
C       'prayer time table for any region in the world
C       'calculated by t. djamaluddin
C       'dept. of astronomy, kyoto university
C       'sakyo-ku, kyoto 606, japan
C       '*****************************************
C
C
C       input description:
C
C       1. city's name
C
C       2. position of the place. we can estimate it from a map.
C          a. longitude in degrees
C             east is positive
C             west is negative
C             for example :
C               nagasaki              : 129.9 e                =+129.9
C               rabat(marocco)        : 6.9 w                  =-6.9
C          b. latitude in degrees
C             north is positive
C             south is negative
C             for example :
C               nagasaki               : 32.7n                 =+32.7
C               jakarta                : 6.2s                  =-6.2
C
C       3. time difference, that is, the difference between standard
C          time of the place and Greenwich Mean Time (GMT).
C          for example :
C            Japan, time difference                            = +9
C            Newyork, time difference                          = -5
C
C----------------------------------------------------------------------
C
C          Result sample problem for Jakarta:
C----------------------------------------------------------------------
C          City`s name                               = JAKARTA
C          City`s longitude (negative deg. for west) = 106.833
C          City`s latitude (negative deg. for south) = -6.183
C          Time difference = standard time - ut/gmt,
C          Time difference (hour); neg. for west     = 7
C
C
C                PRAYER TIME TABLE
C             ***********************
C
C                 City : JAKARTA
C
C
C                     JANUARY
C
C Date  Fajr  Sunrise  Zuhr    `Asr   Maghrib  Isha
C
C  1    4:25    5:45   11:56   15: 1   18: 6   19:26
C  2    4:26    5:45   11:56   15: 1   18: 7   19:26
C  3    4:26    5:46   11:57   15: 2   18: 7   19:27
C  4    4:27    5:46   11:57   15: 2   18: 8   19:27
C  5    4:27    5:47   11:57   15: 3   18: 8   19:27
C  6    4:28    5:47   11:58   15: 3   18: 8   19:28
C  7    4:29    5:48   11:58   15: 4   18: 9   19:28
C  8    4:29    5:48   11:59   15: 4   18: 9   19:28
C  9    4:30    5:49   11:59   15: 4   18: 9   19:29
C 10    4:30    5:49   12: 0   15: 5   18:10   19:29
C 11    4:31    5:50   12: 0   15: 5   18:10   19:29
C 12    4:32    5:50   12: 0   15: 5   18:10   19:29
C 13    4:32    5:51   12: 1   15: 6   18:11   19:29
C 14    4:33    5:51   12: 1   15: 6   18:11   19:30
C 15    4:33    5:52   12: 1   15: 6   18:11   19:30
C
C
C    etc.....
C
C-------------------------------------------------------------
C
        character*80 city
        dimension t(10),o(10),old(10)
        common/blk/z,n,a,lamd,rad,x,td,phi,st
        integer th,tm,t,o
        real n,m,lh,l,lamd,midday
        rad = 3.14159/180
C PRINT CITY'S NAME
C          City`s name                               = GLASGOW
C          City`s longitude (negative deg. for west) = -4
      LAMD=-4
C          City`s latitude (negative deg. for south) = 56
      PHI=56
C          Time difference = standard time - ut/gmt,
C          Time difference (hour); neg. for west     = 1
      OPEN(6,FILE='pray.prn',STATUS='NEW')
      TD=1
      PRINT*,' NAME OF THE CITY                          =   GLASGOW'   
      PRINT*,' City`s longitude (negative deg. for west) =',LAMD
      PRINT*,' City`s latitude (negative deg. for south) =',PHI
      PRINT*,' Time difference = standard time - ut/gmt, '
      PRINT*,' Time difference (hour); neg. for west     =',TD
        write(6,*)' '
        write(6,*)' '
        write(6,*)'          GLASGOW PRAYER TIME TABLE  '
        write(6,*)'        ***************************** '
        write(6,*)' '
        lamd=lamd/360*24
        phi=phi*rad
        n0=0
        do 200 i=1,12
          write(6,*)'  '
          write(6,*)'  '
          if(i.eq.1)then
                d=31
                write(6,*)'                     JANUARY '
          elseif(i.eq.2)then
                d=28
                write(6,*)'                     FEBRUARY '
          elseif(i.eq.3)then
                d=31
                write(6,*)'                       MARCH '
          elseif(i.eq.4)then
                d=30
                write(6,*)'                       APRIL'
          elseif(i.eq.5)then
                d=31
                write(6,*)'                        MAY '
          elseif(i.eq.6)then
                d=30
                write(6,*)'                        JUNE  '
          elseif(i.eq.7)then
                d=31
                write(6,*)'                        JULY '
          elseif(i.eq.8)then
                d=31
                write(6,*)'                       AUGUST'
          elseif(i.eq.9) then
                d=30
                write(6,*)'                     SEPTEMBER'
          elseif(i.eq.10) then
                d=31
                write(6,*)'                      OCTOBER'
          elseif(i.eq.11) then
                d=30
                write(6,*)'                      NOVEMBER '
          elseif(i.eq.12) then
                d=31
                write(6,*)'                      DECEMBER '
          endif
          write(6,*)' '
          write(6,*)' Date  Fajr  Sunrise  Zuhr    `Asr   Maghrib  Isa'
          write(6,*)' '
          do 210 k=1,d
             n = n0 + k
             a = 6
             z = 108*rad
             call calc
             if(abs(x).gt.1)goto 300
             old(1)=st
             t(1)=int(st)
             o(1)=int((st-t(1))*60.)
  300        z = (90+5/6)*rad
             call calc
             old(2)=st
             t(2)=int(st)
             o(2)=int((st-t(2))*60.)
             a = 18
             z = (90+5/6)*rad
             call calc
             sunset = st
             old(5) = st + 2/60
             st=old(5)
             t(5)=int(st)
             o(5)=int((st-t(5))*60.)
             z = 108*rad
             call calc
             if (abs(x).gt.1)goto 370
             old(6)=st
             t(6) = st
             t(6)=int(st)
             o(6)=int((st-t(6))*60.)
370          midday = (old(2) + sunset)/2
             old(3) = midday + 2/60
             st=old(3)
             t(3)=int(st)
             o(3)=int((st-t(3))*60.)
             old(4) = (old(3)+old(5))/2
             st=old(4)
             t(4)=int(st)
             o(4)=int((st-t(4))*60.)
             write(6,110)k,(t(ii),o(ii),ii=1,6)
110          format(i4,3x,6(i2,':',i2,3x))
210       continue
          n0=n
200     continue
        stop
        end
c------------------------------------------------------------------
        subroutine calc
        common/blk/z,n,a,lamd,rad,x,td,phi,st
        real n,m,lh,l,lamd
c       write(6,*)n,a,lamd,rad,x,st
        tm = n + (a - lamd)/24
        m = (.9856*tm - 3.289)*rad
        l = m + 1.916*rad*sin(m) + .02*rad*sin(2*m) + 282.634*rad
        lh = l/3.14159*12
        ql = int(lh/6)+1
        if(int(ql/2)*2-ql.ne.0)ql=ql-1
        ra = atan(.91746*tan(l))/3.14159*12
        ra = ra + ql*6
        sind = .39782*sin(l)
        cosd = sqrt(1-sind*sind)
        x = (cos(z) - sind*sin(phi))/(cosd*cos(phi))
        if (abs(x).gt.1) goto 670
        atnx = atan(sqrt(1-x*x)/x)/rad
        if (atnx .lt. 0) atnx = atnx + 180
        h = (360-atnx)*24/360
        if(a.eq.18) h = 24 - h
        tloc = h + ra - .06571*tm - 6.622
        tloc = tloc + 24
        tloc = tloc - int(tloc/24)*24
        st = tloc - lamd + td
670     return
        end
C---------------------------------------------------------------