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

Diff for /src/usr.bin/calendar/ostern.c between version 1.4 and 1.10

version 1.4, 2003/06/25 22:41:24 version 1.10, 2024/04/23 13:34:50
Line 24 
Line 24 
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.   * SUCH DAMAGE.
  *  
  *      $Id$  
  */   */
   
 #ifndef lint  
 static char rcsid[] = "$OpenBSD$";  
 #endif /* not lint */  
   
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  
 #include <string.h>  
 #include <time.h>  #include <time.h>
 #include <tzfile.h>  
   
 #include "calendar.h"  #include "calendar.h"
   
 /* return year day for Easter */  /* return year day for Easter */
   
 int easter (year)  int
     int year;            /* 0 ... abcd, NOT since 1900 */  easter(int year)        /* 0 ... abcd, NOT since 1900 */
 {  {
           int     e_a, e_b, e_c, e_d, e_e,e_f, e_g, e_h, e_i, e_k;
           int     e_l, e_m, e_n, e_p, e_q;
   
     int e_a, e_b, e_c, e_d, e_e,e_f, e_g, e_h, e_i, e_k,          /* silly, but it works */
         e_l, e_m, e_n, e_p, e_q;          e_a = year % 19;
           e_b = year / 100;
           e_c = year % 100;
   
     /* silly, but it works */          e_d = e_b / 4;
     e_a = year % 19;          e_e = e_b % 4;
     e_b = year / 100;          e_f = (e_b + 8) / 25;
     e_c = year % 100;          e_g = (e_b + 1 - e_f) / 3;
           e_h = ((19 * e_a) + 15 + e_b - (e_d + e_g)) % 30;
           e_i = e_c / 4;
           e_k = e_c % 4;
           e_l = (32 + 2 * e_e + 2 * e_i - (e_h + e_k)) % 7;
           e_m = (e_a + 11 * e_h + 22 * e_l) / 451;
           e_n = (e_h + e_l + 114 - (7 * e_m)) / 31;
           e_p = (e_h + e_l + 114 - (7 * e_m)) % 31;
           e_p = e_p + 1;
   
     e_d = e_b / 4;          e_q = 31 + 28 + e_p;
     e_e = e_b % 4;          if (isleap(year))
     e_f = (e_b + 8) / 25;                  e_q++;
     e_g = (e_b + 1 - e_f) / 3;  
     e_h = ((19 * e_a) + 15 + e_b - (e_d + e_g)) % 30;  
     e_i = e_c / 4;  
     e_k = e_c % 4;  
     e_l = (32 + 2 * e_e + 2 * e_i - (e_h + e_k)) % 7;  
     e_m = (e_a + 11 * e_h + 22 * e_l) / 451;  
     e_n = (e_h + e_l + 114 - (7 * e_m)) / 31;  
     e_p = (e_h + e_l + 114 - (7 * e_m)) % 31;  
     e_p = e_p + 1;  
   
     e_q = 31 + 28 + e_p;          if (e_n == 4)
     if (isleap(year))                  e_q += 31;
             e_q++;  
   
     if (e_n == 4)  
         e_q += 31;  
   
 #if DEBUG  #if DEBUG
     printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", e_a , e_b , e_c , e_d , e_e , e_f , e_g , e_h , e_i , e_k , e_l , e_m , e_n  , e_p , e_q);          printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
               e_a, e_b, e_c, e_d, e_e, e_f, e_g, e_h,
               e_i, e_k, e_l, e_m, e_n, e_p, e_q);
 #endif  #endif
   
     return (e_q);          return (e_q);
 }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.10