FACT++  1.0
int eraJd2cal ( double  dj1,
double  dj2,
int *  iy,
int *  im,
int *  id,
double *  fd 
)

Definition at line 3 of file jd2cal.c.

References i.

Referenced by eraD2dtf(), eraDtf2d(), eraJdcalf(), eraUt1utc(), eraUtctai(), eraUtcut1(), palDat(), palDjcal(), palDjcl(), and t_jd2cal().

56 {
57 /* Minimum and maximum allowed JD */
58  const double DJMIN = -68569.5;
59  const double DJMAX = 1e9;
60 
61  long jd, l, n, i, k;
62  double dj, d1, d2, f1, f2, f, d;
63 
64 /* Verify date is acceptable. */
65  dj = dj1 + dj2;
66  if (dj < DJMIN || dj > DJMAX) return -1;
67 
68 /* Copy the date, big then small, and re-align to midnight. */
69  if (dj1 >= dj2) {
70  d1 = dj1;
71  d2 = dj2;
72  } else {
73  d1 = dj2;
74  d2 = dj1;
75  }
76  d2 -= 0.5;
77 
78 /* Separate day and fraction. */
79  f1 = fmod(d1, 1.0);
80  f2 = fmod(d2, 1.0);
81  f = fmod(f1 + f2, 1.0);
82  if (f < 0.0) f += 1.0;
83  d = floor(d1 - f1) + floor(d2 - f2) + floor(f1 + f2 - f);
84  jd = (long) floor(d) + 1L;
85 
86 /* Express day in Gregorian calendar. */
87  l = jd + 68569L;
88  n = (4L * l) / 146097L;
89  l -= (146097L * n + 3L) / 4L;
90  i = (4000L * (l + 1L)) / 1461001L;
91  l -= (1461L * i) / 4L - 31L;
92  k = (80L * l) / 2447L;
93  *id = (int) (l - (2447L * k) / 80L);
94  l = k / 11L;
95  *im = (int) (k + 2L - 12L * l);
96  *iy = (int) (100L * (n - 49L) + i + l);
97  *fd = f;
98 
99  return 0;
100 
101 }
int i
Definition: db_dim_client.c:21

+ Here is the caller graph for this function: