Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
caldate_mjd(3)		    Library Functions Manual		  caldate_mjd(3)

NAME
     caldate_mjd - manipulate calendar dates

SYNTAX
     #include <caldate.h>

     void caldate_frommjd(&cd,day,weekday,yearday);
     long caldate_mjd(&cd);
     void caldate_normalize(&cd);

     void caldate_easter(&cd);

     struct caldate cd;
     long day;
     int *weekday;
     int *yearday;

BASIC CONVERSIONS
     Every  calendar  date has a modified Julian day number.  The day number in-
     creases by 1 every day.  Day number 0 is  17  November  1858.   Day  number
     51604 is 1 March 2000.

     caldate_frommjd  puts into cd the date corresponding to the modified Julian
     day number day.

     caldate_frommjd also computes the day of the week (0 through 6) and the day
     of the year (0 through 365).  It stores the day of the week in *weekday  if
     weekday  is  nonzero.  It stores the day of the year in *yearday if yearday
     is nonzero.

     caldate_mjd returns the modified Julian day  number  corresponding  to  the
     date in cd.

     caldate_mjd  accepts  days outside the range 1 to 31, referring to days be-
     fore the beginning or after the end of the month.	It also  accepts  months
     outside  the range 1 to 12, referring to months before the beginning or af-
     ter the end of the year.

     caldate_normalize calls caldate_frommjd with  the	result	of  caldate_mjd.
     This means that it accepts out-of-range months and out-of-range days in cd,
     and puts a valid calendar date back into cd.

OTHER FUNCTIONS
     caldate_easter  reads  the  year from cd and then changes cd to the date of
     Easter in the same year.

LIMITATIONS
     The caldate routines currently support the Gregorian  calendar,  which  was
     defined in 1582 and adopted at different times in different countries.  For
     earlier dates the caldate routines work with ``virtual Gregorian,'' defined
     mathematically  by the 400-year Gregorian cycle for years before 1582.  The
     Julian calendar is not supported.

     The Gregorian calendar will be replaced by a  new	calendar  within  a  few
     thousand  years.	The caldate_frommjd and caldate_mjd routines will be up-
     graded accordingly.  The current caldate_frommjd and  caldate_mjd	routines
     are not useful for dates far in the future.

     Day  numbers  will  overflow a 32-bit long sometime after the year 5000000;
     all systems should upgrade to 64-bit longs before then.   caldate_mjd  does
     not check for overflow.

SEE ALSO
     caldate(3)

								  caldate_mjd(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=caldate_mjd&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help