< previous page page_189 next page >

Page 189
(continued)
Listing 7.5
   2. This conversion does NOT allow a date designated as 'Old Style'
      (O.S.) to be converted to a new 'New Style' date, in those situations
      where the 'first of year' convention was also changed when the
      Gregorian calendar was adopted. E.g., in the former British
      possessions, including America, the first of the year was changed
      from March to January at the time of the adoption of the Gregorian
      calendar. Also note that different countries adopted the Gregorian
      calendar at different dates.


   3. This routine does not validate the input. To validate Julian dates,
      use the routine in this series 'valid_date_julian ()'.
*/


#include "scdtl_6.h"


struct DATE_INFO julian_to_gregorian (struct DATE_INFO *jdate)
{
   double jd;
   struct DATE_INFO gdate;


   jd = julian_proleptic_to_JD0 (jdate);
   gdate = JD0_to_gregorian_proleptic (jd);


   return (gdate);
}

Listing 7.6 gregorian_to_julian ()
/* greg2jul.c


   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+


   Routine converts a proleptic Gregorian calendar date into the
   corresponding proleptic Julian calendar date.


   INPUTS:


   1. gdate, pointer to a DATE_INFO structure, containing the proleptic
      Gregorian date to be converted.


   OUTPUTS:


   1. Returned by routine, a DATE_INFO structure, containing the
      proleptic Julian date corresponding to the input Gregorian date.


   NOTES:


   1. This routine can be used to convert proleptic Gregorian dates into
      their correct Julian dates. It may also be used to convert
      correct Gregorian dates into proleptic Julian dates.

 
< previous page page_189 next page >