[BACK]Return to paskha.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / calendar

Diff for /src/usr.bin/calendar/paskha.c between version 1.1 and 1.2

version 1.1, 1996/12/05 06:04:41 version 1.2, 1998/12/13 07:31:08
Line 34 
Line 34 
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <time.h>  #include <time.h>
   #include <tzfile.h>
   
 #include "calendar.h"  
   
 #define PASKHA "paskha"  
 #define PASKHALEN (sizeof(PASKHA) - 1)  
   
 /* return year day for Orthodox Easter using Gauss formula */  /* return year day for Orthodox Easter using Gauss formula */
 /* (old style result) */  /* (new style result); subtract 13 for old style */
   
 static int  int
 paskha (R)  paskha (R)
 int R;  /*year*/          int R;  /*year*/
 {  {
         int a, b, c, d, e;          int a, b, c, d, e;
         static int x = 15;          static int x = 15;
         static int y = 6;          static int y = 6;
         extern int *cumdays;          int cumdays;
   
         a = R % 19;          a = R % 19;
         b = R % 4;          b = R % 4;
         c = R % 7;          c = R % 7;
         d = (19*a + x) % 30;          d = (19*a + x) % 30;
         e = (2*b + 4*c + 6*d + y) % 7;          e = (2*b + 4*c + 6*d + y) % 7;
         return (((cumdays[3] + 1) + 22) + (d + e));          cumdays = 31 + 28;
 }          if (isleap(R))
                   cumdays++;
 /* return year day for Orthodox Easter depending days */          return ((cumdays + 22) + (d + e) + 13);
   
 int  
 getpaskha(s, year)  
         char *s;  
         int year;  
 {  
         int offset;  
         extern struct fixs npaskha;  
   
         if (strncasecmp(s, PASKHA, PASKHALEN) == 0)  
             s += PASKHALEN;  
         else if (   npaskha.name != NULL  
                  && strncasecmp(s, npaskha.name, npaskha.len) == 0  
                 )  
             s += npaskha.len;  
         else  
             return 0;  
   
   
         /* Paskha+1  or Paskha-2  
          *       ^            ^   */  
   
         switch(*s) {  
   
         case '-':  
         case '+':  
             offset = atoi(s);  
             break;  
   
         default:  
             offset = 0;  
             break;  
         }  
   
         return (paskha(year) + offset + 13/* new style */);  
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2