source: trunk/MagicSoft/slalib/calyd.c@ 18679

Last change on this file since 18679 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaCalyd ( int iy, int im, int id, int *ny, int *nd, int *j )
4/*
5** - - - - - - - - -
6** s l a C a l y d
7** - - - - - - - - -
8**
9** Gregorian calendar date to year and day in year (in a Julian
10** calendar aligned to the 20th/21st century Gregorian calendar).
11**
12** (Includes century default feature: use slaClyd for years
13** before 100AD.)
14**
15** Given:
16** iy,im,id int year, month, day in Gregorian calendar
17** (year may optionally omit the century)
18** Returned:
19** *ny int year (re-aligned Julian calendar)
20** *nd int day in year (1 = January 1st)
21** *j int status:
22** 0 = OK
23** 1 = bad year (before -4711)
24** 2 = bad month
25** 3 = bad day (but conversion performed)
26**
27** Notes:
28**
29** 1 This routine exists to support the low-precision routines
30** slaEarth, slaMoon and slaEcor.
31**
32** 2 Between 1900 March 1 and 2100 February 28 it returns answers
33** which are consistent with the ordinary Gregorian calendar.
34** Outside this range there will be a discrepancy which increases
35** by one day for every non-leap century year.
36**
37** 3 Years in the range 50-99 are interpreted as 1950-1999, and
38** years in the range 00-49 are interpreted as 2000-2049.
39**
40** Called: slaClyd
41**
42** Last revision: 22 September 1995
43**
44** Copyright P.T.Wallace. All rights reserved.
45*/
46{
47 int i;
48
49/* Default century if appropriate */
50 if ( ( iy >= 0 ) && ( iy <= 49 ) )
51 i = iy + 2000;
52 else if ( ( iy >= 50 ) && ( iy <= 99 ) )
53 i = iy + 1900;
54 else
55 i = iy;
56
57/* Perform the conversion */
58 slaClyd ( i, im, id, ny, nd, j );
59}
Note: See TracBrowser for help on using the repository browser.