mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
Delete "typedef ... date" (see style(9)).
In the man page Use ".Pp" instead of blank lines, adopt English and stress that the Julian->Gregorian switch took place at different dates in different countries. Suggested by: Garrett.
This commit is contained in:
parent
cae80f25d3
commit
fa18377023
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31698
@ -22,7 +22,7 @@
|
|||||||
.\" 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: calendar.3,v 1.1.1.1 1997/12/04 10:41:49 helbig Exp $
|
.\" $Id: calendar.3,v 1.2 1997/12/07 19:04:08 helbig Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd November 29, 1997
|
.Dd November 29, 1997
|
||||||
.Dt CALENDAR 3
|
.Dt CALENDAR 3
|
||||||
@ -40,20 +40,20 @@
|
|||||||
.Nd Calendar arithmetic for the Christian era.
|
.Nd Calendar arithmetic for the Christian era.
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Fd #include <calendar.h>
|
.Fd #include <calendar.h>
|
||||||
.Ft date *
|
.Ft struct date *
|
||||||
.Fn easterg "int year" "date *dt"
|
.Fn easterg "int year" "struct date *dt"
|
||||||
.Ft date *
|
.Ft struct date *
|
||||||
.Fn easterog "int year" "date *dt"
|
.Fn easterog "int year" "struct date *dt"
|
||||||
.Ft date *
|
.Ft struct date *
|
||||||
.Fn easteroj "int year" "date *dt"
|
.Fn easteroj "int year" "struct date *dt"
|
||||||
.Ft date *
|
.Ft struct date *
|
||||||
.Fn gdate "int nd" "date *dt"
|
.Fn gdate "int nd" "struct date *dt"
|
||||||
.Ft date *
|
.Ft struct date *
|
||||||
.Fn jdate "int nd" "date *dt"
|
.Fn jdate "int nd" "struct date *dt"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn ndaysg "date *dt"
|
.Fn ndaysg "struct date *dt"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn ndaysj "date *dt"
|
.Fn ndaysj "struct date *dt"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn week "int nd" "int *year"
|
.Fn week "int nd" "int *year"
|
||||||
.Ft int
|
.Ft int
|
||||||
@ -62,10 +62,10 @@
|
|||||||
These functions provide calendar arithmetic for a large range of years,
|
These functions provide calendar arithmetic for a large range of years,
|
||||||
starting at March 1st, year zero (i. e. 1 B.C.) and ending way beyond
|
starting at March 1st, year zero (i. e. 1 B.C.) and ending way beyond
|
||||||
year 100000.
|
year 100000.
|
||||||
|
.Pp
|
||||||
Programs should be linked with
|
Programs should be linked with
|
||||||
.Fl lcalendar .
|
.Fl lcalendar .
|
||||||
|
.Pp
|
||||||
The functions
|
The functions
|
||||||
.Fn easterg ,
|
.Fn easterg ,
|
||||||
.Fn easterog
|
.Fn easterog
|
||||||
@ -89,7 +89,7 @@ The result returned by
|
|||||||
is the date in Gregorian Calendar, whereas
|
is the date in Gregorian Calendar, whereas
|
||||||
.Fn easteroj
|
.Fn easteroj
|
||||||
returns the date in Julian Calendar.
|
returns the date in Julian Calendar.
|
||||||
|
.Pp
|
||||||
The functions
|
The functions
|
||||||
.Fn gdate ,
|
.Fn gdate ,
|
||||||
.Fn jdate ,
|
.Fn jdate ,
|
||||||
@ -101,7 +101,7 @@ of a date and the "number of days" representation, which is better suited
|
|||||||
for calculations. The days are numbered from March 1st year 1 B.C., starting
|
for calculations. The days are numbered from March 1st year 1 B.C., starting
|
||||||
with zero, so the number of a day gives the number of days since March 1st,
|
with zero, so the number of a day gives the number of days since March 1st,
|
||||||
year 1 B.C. The conversions work for nonnegative day numbers only.
|
year 1 B.C. The conversions work for nonnegative day numbers only.
|
||||||
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn gdate
|
.Fn gdate
|
||||||
and
|
and
|
||||||
@ -112,7 +112,7 @@ store the date corresponding to the day number
|
|||||||
into the structure pointed at by
|
into the structure pointed at by
|
||||||
.Fa dt
|
.Fa dt
|
||||||
and return a pointer to this structure.
|
and return a pointer to this structure.
|
||||||
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn ndaysg
|
.Fn ndaysg
|
||||||
and
|
and
|
||||||
@ -120,19 +120,19 @@ and
|
|||||||
functions
|
functions
|
||||||
return the day number of the date pointed at by
|
return the day number of the date pointed at by
|
||||||
.Fa dt .
|
.Fa dt .
|
||||||
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn gdate
|
.Fn gdate
|
||||||
and
|
and
|
||||||
.Fn ndaysg
|
.Fn ndaysg
|
||||||
functions
|
functions
|
||||||
assume Gregorian Calendar after October 4th 1582 and Julian Calendar before,
|
assume Gregorian Calendar after October 4, 1582 and Julian Calendar before,
|
||||||
whereas
|
whereas
|
||||||
.Fn jdate
|
.Fn jdate
|
||||||
and
|
and
|
||||||
.Fn ndaysj
|
.Fn ndaysj
|
||||||
assume Julian Calendar throughout.
|
assume Julian Calendar throughout.
|
||||||
|
.Pp
|
||||||
The two calendars differ by the definition of the leap year. The
|
The two calendars differ by the definition of the leap year. The
|
||||||
Julian Calendar says every year that is a multiple of four is a
|
Julian Calendar says every year that is a multiple of four is a
|
||||||
leap year. The Gregorian Calendar excludes years that are multiples of
|
leap year. The Gregorian Calendar excludes years that are multiples of
|
||||||
@ -140,9 +140,13 @@ leap year. The Gregorian Calendar excludes years that are multiples of
|
|||||||
This means the years 1700, 1800, 1900, 2100 are not leap years
|
This means the years 1700, 1800, 1900, 2100 are not leap years
|
||||||
and the year 2000 is
|
and the year 2000 is
|
||||||
a leap year.
|
a leap year.
|
||||||
The new rules were inaugurated on October 4th 1582 by deleting ten
|
The new rules were inaugurated on October 4, 1582 by deleting ten
|
||||||
days following this date.
|
days following this date. Most catholic countries adopted the new
|
||||||
|
calendar by the end of the 16th century, whereas others stayed with
|
||||||
|
the Julian Calendar until the 20th century. The United Kingdom and
|
||||||
|
their colonies switched on September 2, 1752. They already had to
|
||||||
|
delete 11 days.
|
||||||
|
.Pp
|
||||||
The function
|
The function
|
||||||
.Fn week
|
.Fn week
|
||||||
returns the number of the week which contains the day numbered
|
returns the number of the week which contains the day numbered
|
||||||
@ -154,15 +158,15 @@ The weeks are numbered per year starting with week 1, which is the
|
|||||||
first week in a year that includes more than three days of the year.
|
first week in a year that includes more than three days of the year.
|
||||||
Weeks start on Monday.
|
Weeks start on Monday.
|
||||||
This function is defined for Gregorian Calendar only.
|
This function is defined for Gregorian Calendar only.
|
||||||
|
.Pp
|
||||||
The function
|
The function
|
||||||
.Fn weekday
|
.Fn weekday
|
||||||
returns the weekday (Mo = 0 .. Su = 6) of the day numbered
|
returns the weekday (Mo = 0 .. Su = 6) of the day numbered
|
||||||
.Fa nd .
|
.Fa nd .
|
||||||
|
.Pp
|
||||||
The type
|
The structure
|
||||||
.Fa date
|
.Fa date
|
||||||
is a structure defined in
|
is defined in
|
||||||
.Aq Pa calendar.h .
|
.Aq Pa calendar.h .
|
||||||
It contains these fields:
|
It contains these fields:
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
@ -170,7 +174,7 @@ int y; /\(** year (0000 - ????) \(**/
|
|||||||
int m; /\(** month (1 - 12) \(**/
|
int m; /\(** month (1 - 12) \(**/
|
||||||
int d; /\(** day of month (1 - 31) \(**/
|
int d; /\(** day of month (1 - 31) \(**/
|
||||||
.Ed
|
.Ed
|
||||||
|
.Pp
|
||||||
The year zero is written as "1 B.C." by historians and "0" by astronomers
|
The year zero is written as "1 B.C." by historians and "0" by astronomers
|
||||||
and in this library.
|
and in this library.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* 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$
|
* $Id: calendar.c,v 1.1.1.1 1997/12/04 10:41:49 helbig Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
@ -46,6 +46,8 @@ static int const month1[] =
|
|||||||
static int const month1s[]=
|
static int const month1s[]=
|
||||||
{0, 31, 61, 92, 122, 153, 184, 214, 235, 265, 296, 327};
|
{0, 31, 61, 92, 122, 153, 184, 214, 235, 265, 296, 327};
|
||||||
|
|
||||||
|
typedef struct date date;
|
||||||
|
|
||||||
/* The last day of Julian calendar, in internal and ndays representation */
|
/* The last day of Julian calendar, in internal and ndays representation */
|
||||||
static int nswitch; /* The last day of Julian calendar */
|
static int nswitch; /* The last day of Julian calendar */
|
||||||
static date jiswitch = {1582, 7, 3};
|
static date jiswitch = {1582, 7, 3};
|
||||||
|
@ -23,20 +23,20 @@
|
|||||||
* 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: calendar.h,v 1.1.1.1 1997/12/04 10:41:49 helbig Exp $
|
* $Id: calendar.h,v 1.2 1997/12/07 19:04:11 helbig Exp $
|
||||||
*/
|
*/
|
||||||
typedef struct date {
|
struct date {
|
||||||
int y; /* year */
|
int y; /* year */
|
||||||
int m; /* month */
|
int m; /* month */
|
||||||
int d; /* day */
|
int d; /* day */
|
||||||
} date;
|
};
|
||||||
|
|
||||||
date *easterg(int _year, date *_dt);
|
struct date *easterg(int _year, struct date *_dt);
|
||||||
date *easterog(int _year, date *_dt);
|
struct date *easterog(int _year, struct date *_dt);
|
||||||
date *easteroj(int _year, date *_dt);
|
struct date *easteroj(int _year, struct date *_dt);
|
||||||
date *gdate(int _nd, date *_dt);
|
struct date *gdate(int _nd, struct date *_dt);
|
||||||
date *jdate(int _nd, date *_dt);
|
struct date *jdate(int _nd, struct date *_dt);
|
||||||
int ndaysg(date *_dt);
|
int ndaysg(struct date *_dt);
|
||||||
int ndaysj(date *_dt);
|
int ndaysj(struct date *_dt);
|
||||||
int week(int _nd, int *_year);
|
int week(int _nd, int *_year);
|
||||||
int weekday(int _nd);
|
int weekday(int _nd);
|
||||||
|
@ -23,11 +23,13 @@
|
|||||||
* 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: easter.c,v 1.1.1.1 1997/12/04 10:41:49 helbig Exp $
|
* $Id: easter.c,v 1.2 1997/12/07 19:04:14 helbig Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
|
||||||
|
typedef struct date date;
|
||||||
|
|
||||||
static int easterodn(int y);
|
static int easterodn(int y);
|
||||||
|
|
||||||
/* Compute Easter Sunday in Gregorian Calendar */
|
/* Compute Easter Sunday in Gregorian Calendar */
|
||||||
|
Loading…
Reference in New Issue
Block a user