calendar.3 (4000696ce70869ac63f33c1c1cdc47349ad54669) calendar.3 (fa1837702339667092ca19afec47972849aa88fb)
1.\" Copyright (c) 1997 Wolfgang Helbig
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

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
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 1997 Wolfgang Helbig
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

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
23.\" SUCH DAMAGE.
24.\"
25.\" $Id: calendar.3,v 1.1.1.1 1997/12/04 10:41:49 helbig Exp $
25.\" $Id: calendar.3,v 1.2 1997/12/07 19:04:08 helbig Exp $
26.\"
27.Dd November 29, 1997
28.Dt CALENDAR 3
29.Os
30.Sh NAME
31.Nm easterg ,
32.Nm easterog ,
33.Nm easteroj ,
34.Nm gdate ,
35.Nm jdate ,
36.Nm ndaysg ,
37.Nm ndaysj ,
38.Nm week ,
39.Nm weekday
40.Nd Calendar arithmetic for the Christian era.
41.Sh SYNOPSIS
42.Fd #include <calendar.h>
26.\"
27.Dd November 29, 1997
28.Dt CALENDAR 3
29.Os
30.Sh NAME
31.Nm easterg ,
32.Nm easterog ,
33.Nm easteroj ,
34.Nm gdate ,
35.Nm jdate ,
36.Nm ndaysg ,
37.Nm ndaysj ,
38.Nm week ,
39.Nm weekday
40.Nd Calendar arithmetic for the Christian era.
41.Sh SYNOPSIS
42.Fd #include <calendar.h>
43.Ft date *
44.Fn easterg "int year" "date *dt"
45.Ft date *
46.Fn easterog "int year" "date *dt"
47.Ft date *
48.Fn easteroj "int year" "date *dt"
49.Ft date *
50.Fn gdate "int nd" "date *dt"
51.Ft date *
52.Fn jdate "int nd" "date *dt"
43.Ft struct date *
44.Fn easterg "int year" "struct date *dt"
45.Ft struct date *
46.Fn easterog "int year" "struct date *dt"
47.Ft struct date *
48.Fn easteroj "int year" "struct date *dt"
49.Ft struct date *
50.Fn gdate "int nd" "struct date *dt"
51.Ft struct date *
52.Fn jdate "int nd" "struct date *dt"
53.Ft int
53.Ft int
54.Fn ndaysg "date *dt"
54.Fn ndaysg "struct date *dt"
55.Ft int
55.Ft int
56.Fn ndaysj "date *dt"
56.Fn ndaysj "struct date *dt"
57.Ft int
58.Fn week "int nd" "int *year"
59.Ft int
60.Fn weekday "int nd"
61.Sh DESCRIPTION
62These functions provide calendar arithmetic for a large range of years,
63starting at March 1st, year zero (i. e. 1 B.C.) and ending way beyond
64year 100000.
57.Ft int
58.Fn week "int nd" "int *year"
59.Ft int
60.Fn weekday "int nd"
61.Sh DESCRIPTION
62These functions provide calendar arithmetic for a large range of years,
63starting at March 1st, year zero (i. e. 1 B.C.) and ending way beyond
64year 100000.
65
65.Pp
66Programs should be linked with
67.Fl lcalendar .
66Programs should be linked with
67.Fl lcalendar .
68
68.Pp
69The functions
70.Fn easterg ,
71.Fn easterog
72and
73.Fn easteroj
74store the date of Easter Sunday into the structure pointed at by
75.Fa dt
76and return a pointer to this structure.

--- 7 unchanged lines hidden (view full) ---

84compute the date of Easter Sunday according to the orthodox rules
85(Western churches before 1582, Greek and Russian Orthodox Church
86until today).
87The result returned by
88.Fn easterog
89is the date in Gregorian Calendar, whereas
90.Fn easteroj
91returns the date in Julian Calendar.
69The functions
70.Fn easterg ,
71.Fn easterog
72and
73.Fn easteroj
74store the date of Easter Sunday into the structure pointed at by
75.Fa dt
76and return a pointer to this structure.

--- 7 unchanged lines hidden (view full) ---

84compute the date of Easter Sunday according to the orthodox rules
85(Western churches before 1582, Greek and Russian Orthodox Church
86until today).
87The result returned by
88.Fn easterog
89is the date in Gregorian Calendar, whereas
90.Fn easteroj
91returns the date in Julian Calendar.
92
92.Pp
93The functions
94.Fn gdate ,
95.Fn jdate ,
96.Fn ndaysg
97and
98.Fn ndaysj
99provide conversions between the common "year, month, day" notation
100of a date and the "number of days" representation, which is better suited
101for calculations. The days are numbered from March 1st year 1 B.C., starting
102with zero, so the number of a day gives the number of days since March 1st,
103year 1 B.C. The conversions work for nonnegative day numbers only.
93The functions
94.Fn gdate ,
95.Fn jdate ,
96.Fn ndaysg
97and
98.Fn ndaysj
99provide conversions between the common "year, month, day" notation
100of a date and the "number of days" representation, which is better suited
101for calculations. The days are numbered from March 1st year 1 B.C., starting
102with zero, so the number of a day gives the number of days since March 1st,
103year 1 B.C. The conversions work for nonnegative day numbers only.
104
104.Pp
105The
106.Fn gdate
107and
108.Fn jdate
109functions
110store the date corresponding to the day number
111.Fa nd
112into the structure pointed at by
113.Fa dt
114and return a pointer to this structure.
105The
106.Fn gdate
107and
108.Fn jdate
109functions
110store the date corresponding to the day number
111.Fa nd
112into the structure pointed at by
113.Fa dt
114and return a pointer to this structure.
115
115.Pp
116The
117.Fn ndaysg
118and
119.Fn ndaysj
120functions
121return the day number of the date pointed at by
122.Fa dt .
116The
117.Fn ndaysg
118and
119.Fn ndaysj
120functions
121return the day number of the date pointed at by
122.Fa dt .
123
123.Pp
124The
125.Fn gdate
126and
127.Fn ndaysg
128functions
124The
125.Fn gdate
126and
127.Fn ndaysg
128functions
129assume Gregorian Calendar after October 4th 1582 and Julian Calendar before,
129assume Gregorian Calendar after October 4, 1582 and Julian Calendar before,
130whereas
131.Fn jdate
132and
133.Fn ndaysj
134assume Julian Calendar throughout.
130whereas
131.Fn jdate
132and
133.Fn ndaysj
134assume Julian Calendar throughout.
135
135.Pp
136The two calendars differ by the definition of the leap year. The
137Julian Calendar says every year that is a multiple of four is a
138leap year. The Gregorian Calendar excludes years that are multiples of
139100 and not multiples of 400.
140This means the years 1700, 1800, 1900, 2100 are not leap years
141and the year 2000 is
142a leap year.
136The two calendars differ by the definition of the leap year. The
137Julian Calendar says every year that is a multiple of four is a
138leap year. The Gregorian Calendar excludes years that are multiples of
139100 and not multiples of 400.
140This means the years 1700, 1800, 1900, 2100 are not leap years
141and the year 2000 is
142a leap year.
143The new rules were inaugurated on October 4th 1582 by deleting ten
144days following this date.
145
143The new rules were inaugurated on October 4, 1582 by deleting ten
144days following this date. Most catholic countries adopted the new
145calendar by the end of the 16th century, whereas others stayed with
146the Julian Calendar until the 20th century. The United Kingdom and
147their colonies switched on September 2, 1752. They already had to
148delete 11 days.
149.Pp
146The function
147.Fn week
148returns the number of the week which contains the day numbered
149.Fa nd .
150The argument
151.Fa *year
152is set with the year that contains (the greater part of) the week.
153The weeks are numbered per year starting with week 1, which is the
154first week in a year that includes more than three days of the year.
155Weeks start on Monday.
156This function is defined for Gregorian Calendar only.
150The function
151.Fn week
152returns the number of the week which contains the day numbered
153.Fa nd .
154The argument
155.Fa *year
156is set with the year that contains (the greater part of) the week.
157The weeks are numbered per year starting with week 1, which is the
158first week in a year that includes more than three days of the year.
159Weeks start on Monday.
160This function is defined for Gregorian Calendar only.
157
161.Pp
158The function
159.Fn weekday
160returns the weekday (Mo = 0 .. Su = 6) of the day numbered
161.Fa nd .
162The function
163.Fn weekday
164returns the weekday (Mo = 0 .. Su = 6) of the day numbered
165.Fa nd .
162
163The type
166.Pp
167The structure
164.Fa date
168.Fa date
165is a structure defined in
169is defined in
166.Aq Pa calendar.h .
167It contains these fields:
168.Bd -literal -offset indent
169int y; /\(** year (0000 - ????) \(**/
170int m; /\(** month (1 - 12) \(**/
171int d; /\(** day of month (1 - 31) \(**/
172.Ed
170.Aq Pa calendar.h .
171It contains these fields:
172.Bd -literal -offset indent
173int y; /\(** year (0000 - ????) \(**/
174int m; /\(** month (1 - 12) \(**/
175int d; /\(** day of month (1 - 31) \(**/
176.Ed
173
177.Pp
174The year zero is written as "1 B.C." by historians and "0" by astronomers
175and in this library.
176.Sh SEE ALSO
177.Xr ncal 1 ,
178.Xr strftime 3
179.Rs
180.%A A. B. Author
181.%D November 1997

--- 12 unchanged lines hidden ---
178The year zero is written as "1 B.C." by historians and "0" by astronomers
179and in this library.
180.Sh SEE ALSO
181.Xr ncal 1 ,
182.Xr strftime 3
183.Rs
184.%A A. B. Author
185.%D November 1997

--- 12 unchanged lines hidden ---