1 .\" Copyright (c) 1997 Wolfgang Helbig
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd Calendar arithmetic for the Christian era
44 .Fn easterg "int year" "struct date *dt"
46 .Fn easterog "int year" "struct date *dt"
48 .Fn easteroj "int year" "struct date *dt"
50 .Fn gdate "int nd" "struct date *dt"
52 .Fn jdate "int nd" "struct date *dt"
54 .Fn ndaysg "struct date *dt"
56 .Fn ndaysj "struct date *dt"
58 .Fn week "int nd" "int *year"
62 These functions provide calendar arithmetic for a large range of years,
63 starting at March 1st, year zero (i.e., 1 B.C.) and ending way beyond
66 Programs should be linked with
74 store the date of Easter Sunday into the structure pointed at by
76 and return a pointer to this structure.
79 assumes Gregorian Calendar (adopted by most western churches after 1582) and
84 compute the date of Easter Sunday according to the orthodox rules
85 (Western churches before 1582, Greek and Russian Orthodox Church
87 The result returned by
89 is the date in Gregorian Calendar, whereas
91 returns the date in Julian Calendar.
99 provide conversions between the common "year, month, day" notation
100 of a date and the "number of days" representation, which is better suited
102 The days are numbered from March 1st year 1 B.C., starting
103 with zero, so the number of a day gives the number of days since March 1st,
105 The conversions work for nonnegative day numbers only.
112 store the date corresponding to the day number
114 into the structure pointed at by
116 and return a pointer to this structure.
123 return the day number of the date pointed at by
131 assume Gregorian Calendar after October 4, 1582 and Julian Calendar before,
136 assume Julian Calendar throughout.
138 The two calendars differ by the definition of the leap year.
140 Julian Calendar says every year that is a multiple of four is a
142 The Gregorian Calendar excludes years that are multiples of
143 100 and not multiples of 400.
144 This means the years 1700, 1800, 1900, 2100 are not leap years
147 The new rules were inaugurated on October 4, 1582 by deleting ten
148 days following this date.
149 Most catholic countries adopted the new
150 calendar by the end of the 16th century, whereas others stayed with
151 the Julian Calendar until the 20th century.
152 The United Kingdom and
153 their colonies switched on September 2, 1752.
159 returns the number of the week which contains the day numbered
163 is set with the year that contains (the greater part of) the week.
164 The weeks are numbered per year starting with week 1, which is the
165 first week in a year that includes more than three days of the year.
166 Weeks start on Monday.
167 This function is defined for Gregorian Calendar only.
171 returns the weekday (Mo = 0 ..\& Su = 6) of the day numbered
178 It contains these fields:
179 .Bd -literal -offset indent
180 int y; /\(** year (0000 - ????) \(**/
181 int m; /\(** month (1 - 12) \(**/
182 int d; /\(** day of month (1 - 31) \(**/
185 The year zero is written as "1 B.C." by historians and "0" by astronomers
191 The week number conforms to ISO 8601: 1988.
195 library first appeared in
198 This manual page and the library was written by
199 .An Wolfgang Helbig Aq Mt helbig@FreeBSD.org .
201 The library was coded with great care so there are no bugs left.