GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
caldate_mjd(3) FreeBSD Library Functions Manual caldate_mjd(3)

caldate_mjd - manipulate calendar dates

#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;

Every calendar date has a modified Julian day number. The day number increases 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 before 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 after 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.

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

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 upgraded 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.

caldate(3)

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.