Reuse, not rework
Home

License Awareness



Highly Reusable Software

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


NAME

librock_easter - Calculate the serial day number of Easter Sunday
#License - #Source code - #Example Use -

SYNOPSIS

#include <librock/sdncalh.h>

long
librock_EasterSdn(
        int year,
        int julian);

DESCRIPTION

This function calculates the serial day number (SDN) of Easter, using either the Julian calendar calculation (valid from 326 to 4099 A.D.) or the Gregorian calendar calculation (valid from 1583 to 4099 A.D.) (Non-zero for the parameter julian will use the Julian Calendar.)

Even though the Gregorian calendar has the most widespread use, some Orthodox churches continue to use the Julian calendar to calculate the date of Easter. (This date, Orthodox Easter, can be expressed as a Gregorian date, even though it is calculated with the Julian calendar.)

If the year is out of range, 0 is returned. The first Easter after the Gregorian calendar was created was in 1583. Easter was calculated differently before 326 A.D. Sometime after 4099 there will need to be a correction to remove an extra leap year.

The serial day number returned by this function is compatible to Scott E. Lee's sdncal routines.

This was authored by Forrest J. Cavalier III based on information and algorithms printed at http://www.assa.org.au/edm.html#OrthCalculator, and from http://www.oremus.org/liturgy/etc/ktf/app/easter.html

This was tested to match all years 1700-2299 listed at

   http://www.assa.org.au/edm.html

(Other tests indicate it is also accurate for years outside
that range.)

Typical use is

#ifdef librock_TYPICAL_USE_EasterSdn
    #include <librock/sdncalh.h>
    int year = 2000;
    int month;
    int day;
    librock_SdnToGregorian(librock_EasterSdn(year,0),&year,&month,&day);
    printf("%4d %s %d\n",day,librock_MonthNameLong[month],year);
#endif

USES

  librock_JulianToSdn
  librock_GregorianToSdn
  librock_DayOfWeek


LICENSE

  Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com
  Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block.
  License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45

Source Code

./hard/time/easter.c (implementation, plus source of this manual page)

This software is part of Librock

Rapid reuse, without rework. Details
This page copyright (C) 2002-2003 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA

Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)

Want to help? We welcome comments, patches. -- Need help? Request paid support.