File Coverage

blib/lib/Date/JD.pm
Criterion Covered Total %
statement 835 835 100.0
branch 52 98 53.0
condition 1 3 33.3
subroutine 521 521 100.0
pod 512 512 100.0
total 1921 1969 97.5


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Date::JD - conversion between flavours of Julian Date
4              
5             =head1 SYNOPSIS
6              
7             use Date::JD qw(jd_to_mjd mjd_to_cjdnf cjdn_to_rd);
8              
9             $mjd = jd_to_mjd($jd);
10             ($cjdn, $cjdf) = mjd_to_cjdnf($mjd, $tz);
11             $rd = cjdn_to_rd($cjdn, $cjdf);
12              
13             # and 509 other conversion functions
14              
15             =head1 DESCRIPTION
16              
17             For date and time calculations it is convenient to represent dates by
18             a simple linear count of days, rather than in a particular calendar.
19             This is such a good idea that it has been invented several times.
20             If there were a single such linear count then it would be the obvious
21             data interchange format between calendar modules. With several
22             versions, calendar modules can use such sensible data formats and still
23             have interoperability problems. This module tackles that problem,
24             by performing conversions between different flavours of day count.
25             These day count systems are generically known as "Julian Dates", after
26             the most venerable of them.
27              
28             Among Julian Date systems there are also some non-trivial differences
29             of concept. There are systems that count only complete days, and
30             those that count fractional days also. There are some that are fixed
31             to Universal Time (time on the prime meridian), and others that are
32             interpreted according to a timezone. Some consider the day to start at
33             noon and others at midnight, which is semantically significant for the
34             complete-day counts. The functions of this module appropriately handle
35             the semantics of all the non-trivial conversions.
36              
37             The day count systems supported by this module are Julian Date, Reduced
38             Julian Date, Modified Julian Date, Dublin Julian Date, Truncated Julian
39             Date, Chronological Julian Date, Rata Die, and Lilian Date, each in both
40             integral and fractional forms.
41              
42             =head2 Flavours of day count
43              
44             In the interests of orthogonality, all flavours of day count come in both
45             integral and fractional varieties. Generally, there is a quantity named
46             "XYZD" ("XYZ Date") which is a real count of days since a particular epoch
47             (an integer plus a fraction) and a corresponding quantity named "XYZDN"
48             ("XYZ Day Number") which is a count of complete days since the same epoch.
49             XYZDN is the integral part of XYZD. There is also a quantity named
50             "XYZDF" ("XYZ Day Fraction") which is a count of fractional days since
51             the XYZDN changed (whether that is noon or midnight). XYZDF is the
52             fractional part of XYZD, in the range [0, 1).
53              
54             This quantity naming pattern is derived from JD (Julian Date) and JDN
55             (Julian Day Number) which have the described correspondence. Most of
56             the other flavours of day count listed below conventionally come in only
57             one of the two varieties. The "XYZDF" name type is a neologism.
58              
59             All calendar dates given are in ISO 8601 form (Gregorian calendar with
60             astronomical year numbering). An hour number is appended to each date,
61             separated by a "T"; hour 00 is midnight at the start of the day and hour
62             12 is noon in the middle of the day. An appended "Z" indicates that the
63             date is to be interpreted in Universal Time (the timezone of the prime
64             meridian), and so is absolute; where any other timezone is to be used
65             then this is explicitly noted.
66              
67             =over
68              
69             =item JD (Julian Date)
70              
71             days elapsed since -4713-11-24T12Z. This epoch is the most recent
72             coincidence of the first year of the Metonic cycle, indiction cycle, and
73             day-of-week cycle, using the Julian calendar. It was correspondingly
74             named after the Julian calendar, and thus after Julius Caesar. Some
75             information can be found at L.
76              
77             =item RJD (Reduced Julian Date)
78              
79             days elapsed since 1858-11-16T12Z (JD 2400000.0). Rarely used.
80              
81             =item MJD (Modified Julian Date)
82              
83             days elapsed since 1858-11-17T00Z (JD 2400000.5). This was introduced by
84             the Smithsonian Astrophysical Observatory in 1957, and is recommended for
85             general use by the International Astronomical Union and other authorities.
86              
87             =item DJD (Dublin Julian Date)
88              
89             days elapsed since 1899-12-31T12Z (JD 2415020.0). This was invented by
90             the International Astronomical Union, and the epoch in Terrestrial Time
91             is the J1900.0 epoch used in astronomy. (Note: not B1900.0, which is
92             a few hours later.) It is rarely used.
93              
94             =item TJD (Truncated Julian Date)
95              
96             days elapsed since 1968-05-24T00Z (JD 2440000.5). This is primarily
97             used by NASA, who devised it during the Apollo era. There is a
98             rumour that it's defined cyclically, as (JD - 0.5) mod 10000, but see
99             L.
100              
101             =item CJD (Chronological Julian Date)
102              
103             days elapsed since -4713-11-24T00 in the timezone of interest.
104             CJD = JD + 0.5 + Zoff, where Zoff is the timezone offset in
105             fractional days. This was devised by Peter Meyer, and described in
106             L.
107              
108             =item RD (Rata Die)
109              
110             days elapsed since 0000-12-31T00 in the timezone of interest (CJD
111             1721425.0). This is defined in the book Calendrical Calculations.
112             Confusingly, in the book the integral form is also called "RD".
113             The integral form is called "RDN" by this module to avoid confusion,
114             reserving the name "RD" for the fractional form. (The book is best
115             treated with caution due to the embarrassingly large number of errors
116             and instances of muddled thinking.)
117              
118             =item LD (Lilian Date)
119              
120             days elapsed since 1582-10-14T00 in the timezone of interest (CJD
121             2299160.0). This epoch is the day before the day that the Gregorian
122             calendar first went into use. It is named after Aloysius Lilius, the
123             inventor of the Gregorian calendar.
124              
125             =back
126              
127             The interesting differences between these flavours are whether the
128             day starts at noon or at midnight, and whether they are absolute or
129             timezone-relative. Three of the four combinations of these features
130             exist. There is no convention for counting days from timezone-relative
131             noon that the author of this module is aware of.
132              
133             For more background on these day count systems,
134             L is a good starting place.
135              
136             =head2 Meaning of the day
137              
138             A day count has meaning only in the context of a particular definition
139             of "day". There are two main flavours of day to consider: solar and
140             conventional.
141              
142             A solar day is based on the apparent motion of Sol in the Terran sky (and
143             thus on the rotation and orbit of Terra). The rotation of Terra is not
144             constant in time, so this type of day is really a measure of angle, not
145             of time. This is how days have been counted since antiquity, and is still
146             (as of 2006) the basis of civil time. There are two subtypes of solar
147             day: apparent and mean. The apparent solar day is based on the actual
148             observable position of Sol in the sky from day to day, whereas the mean
149             solar day smooths this motion out, in time, over the course of the year.
150             At the sub-second level there are different types of smoothing that can
151             be used (UT1, UT2, et al).
152              
153             A conventional day is any type of day that is not based on Terran
154             rotation. The astronomical Ephemeris Time, a time scale based on the
155             motion of bodies in the Solar system, has a time unit that it calls
156             "day" which is derived from astronomical observations. The modern
157             relativistic coordinate time scales such as TT have a notional "day"
158             of exactly 86400 SI seconds. The atomic time scale TAI also has a "day"
159             which is as close to 86400 SI seconds as can be achieved. All of these
160             "days" are roughly the duration of one Sol-relative rotation of Terra
161             during the early nineteenth century, but are not otherwise related to
162             planetary rotation.
163              
164             Each of the day count scales handled by this module can be used with any
165             of these types of day. For a day number to be meaningful it is necessary
166             to be aware of which kind of day it is counting. Conversion between the
167             different types of day is out of scope for this module. (See L
168             for TAI/UTC conversion.)
169              
170             =cut
171              
172             package Date::JD;
173              
174 1     1   32390 { use 5.006; }
  1         4  
  1         47  
175 1     1   6 use warnings;
  1         1  
  1         35  
176 1     1   6 use strict;
  1         12  
  1         36  
177              
178 1     1   5 use Carp qw(croak);
  1         2  
  1         91  
179              
180             our $VERSION = "0.005";
181              
182 1     1   907 use parent "Exporter";
  1         359  
  1         5  
183             our @EXPORT_OK;
184              
185             my %jd_flavours = (
186             jd => { epoch_jd => 0 },
187             rjd => { epoch_jd => 2400000.0 },
188             mjd => { epoch_jd => 2400000.5 },
189             djd => { epoch_jd => 2415020.0 },
190             tjd => { epoch_jd => 2440000.5 },
191             cjd => { epoch_jd => -0.5, zone => 1 },
192             rd => { epoch_jd => 1721424.5, zone => 1 },
193             ld => { epoch_jd => 2299159.5, zone => 1 },
194             );
195              
196             =head1 FUNCTIONS
197              
198             Day counts in this API may be native Perl numbers or C
199             objects. Both are acceptable for all parameters, in any combination.
200             In all conversion functions, the result is of the same type as the
201             input, provided that the inputs are of consistent type. If native Perl
202             numbers are supplied then the conversion is subject to floating point
203             rounding, and possible overflow if the numbers are extremely large.
204             The use of C is recommended to avoid these problems.
205             With C the results are exact.
206              
207             There are conversion functions between all pairs of day count systems.
208             This is a total of 512 conversion functions (including 32 identity
209             functions).
210              
211             When converting between timezone-relative counts (CJD, RD, LD) and
212             absolute counts (JD, RJD, MJD, DJD, TJD), the timezone that is being used must
213             be specified. It is given in a ZONE argument as a fractional number of
214             days offset from Universal Time. For example, US Central Standard Time,
215             6 hours behind UT, would be specified as a ZONE argument of -0.25.
216             Beware of floating point rounding when the offset does not have a
217             terminating binary representation (e.g., US Eastern Standard Time at
218             -5/24); use of C avoids this problem. A ZONE parameter is
219             not used when converting between absolute day counts (e.g., between JD
220             and MJD) or between timezone-relative counts (e.g., between CJD and LD).
221              
222             =over
223              
224             =item jd_to_jd(JD)
225              
226             =item jd_to_rjd(JD)
227              
228             =item jd_to_mjd(JD)
229              
230             =item jd_to_djd(JD)
231              
232             =item jd_to_tjd(JD)
233              
234             =item jd_to_cjd(JD, ZONE)
235              
236             =item jd_to_rd(JD, ZONE)
237              
238             =item jd_to_ld(JD, ZONE)
239              
240             =item rjd_to_jd(RJD)
241              
242             =item rjd_to_rjd(RJD)
243              
244             =item rjd_to_mjd(RJD)
245              
246             =item rjd_to_djd(RJD)
247              
248             =item rjd_to_tjd(RJD)
249              
250             =item rjd_to_cjd(RJD, ZONE)
251              
252             =item rjd_to_rd(RJD, ZONE)
253              
254             =item rjd_to_ld(RJD, ZONE)
255              
256             =item mjd_to_jd(MJD)
257              
258             =item mjd_to_rjd(MJD)
259              
260             =item mjd_to_mjd(MJD)
261              
262             =item mjd_to_djd(MJD)
263              
264             =item mjd_to_tjd(MJD)
265              
266             =item mjd_to_cjd(MJD, ZONE)
267              
268             =item mjd_to_rd(MJD, ZONE)
269              
270             =item mjd_to_ld(MJD, ZONE)
271              
272             =item djd_to_jd(DJD)
273              
274             =item djd_to_rjd(DJD)
275              
276             =item djd_to_mjd(DJD)
277              
278             =item djd_to_djd(DJD)
279              
280             =item djd_to_tjd(DJD)
281              
282             =item djd_to_cjd(DJD, ZONE)
283              
284             =item djd_to_rd(DJD, ZONE)
285              
286             =item djd_to_ld(DJD, ZONE)
287              
288             =item tjd_to_jd(TJD)
289              
290             =item tjd_to_rjd(TJD)
291              
292             =item tjd_to_mjd(TJD)
293              
294             =item tjd_to_djd(TJD)
295              
296             =item tjd_to_tjd(TJD)
297              
298             =item tjd_to_cjd(TJD, ZONE)
299              
300             =item tjd_to_rd(TJD, ZONE)
301              
302             =item tjd_to_ld(TJD, ZONE)
303              
304             =item cjd_to_jd(CJD, ZONE)
305              
306             =item cjd_to_rjd(CJD, ZONE)
307              
308             =item cjd_to_mjd(CJD, ZONE)
309              
310             =item cjd_to_djd(CJD, ZONE)
311              
312             =item cjd_to_tjd(CJD, ZONE)
313              
314             =item cjd_to_cjd(CJD)
315              
316             =item cjd_to_rd(CJD)
317              
318             =item cjd_to_ld(CJD)
319              
320             =item rd_to_jd(RD, ZONE)
321              
322             =item rd_to_rjd(RD, ZONE)
323              
324             =item rd_to_mjd(RD, ZONE)
325              
326             =item rd_to_djd(RD, ZONE)
327              
328             =item rd_to_tjd(RD, ZONE)
329              
330             =item rd_to_cjd(RD)
331              
332             =item rd_to_rd(RD)
333              
334             =item rd_to_ld(RD)
335              
336             =item ld_to_jd(LD, ZONE)
337              
338             =item ld_to_rjd(LD, ZONE)
339              
340             =item ld_to_mjd(LD, ZONE)
341              
342             =item ld_to_djd(LD, ZONE)
343              
344             =item ld_to_tjd(LD, ZONE)
345              
346             =item ld_to_cjd(LD)
347              
348             =item ld_to_rd(LD)
349              
350             =item ld_to_ld(LD)
351              
352             These functions convert from one continuous day count to another.
353             This principally involve a change of epoch. The input identifies a
354             point in time, as a continuous day count of input flavour. The function
355             returns the same point in time, represented as a continuous day count
356             of output flavour.
357              
358             =item jd_to_jdnn(JD)
359              
360             =item jd_to_rjdnn(JD)
361              
362             =item jd_to_mjdnn(JD)
363              
364             =item jd_to_djdnn(JD)
365              
366             =item jd_to_tjdnn(JD)
367              
368             =item jd_to_cjdnn(JD, ZONE)
369              
370             =item jd_to_rdnn(JD, ZONE)
371              
372             =item jd_to_ldnn(JD, ZONE)
373              
374             =item rjd_to_jdnn(RJD)
375              
376             =item rjd_to_rjdnn(RJD)
377              
378             =item rjd_to_mjdnn(RJD)
379              
380             =item rjd_to_djdnn(RJD)
381              
382             =item rjd_to_tjdnn(RJD)
383              
384             =item rjd_to_cjdnn(RJD, ZONE)
385              
386             =item rjd_to_rdnn(RJD, ZONE)
387              
388             =item rjd_to_ldnn(RJD, ZONE)
389              
390             =item mjd_to_jdnn(MJD)
391              
392             =item mjd_to_rjdnn(MJD)
393              
394             =item mjd_to_mjdnn(MJD)
395              
396             =item mjd_to_djdnn(MJD)
397              
398             =item mjd_to_tjdnn(MJD)
399              
400             =item mjd_to_cjdnn(MJD, ZONE)
401              
402             =item mjd_to_rdnn(MJD, ZONE)
403              
404             =item mjd_to_ldnn(MJD, ZONE)
405              
406             =item djd_to_jdnn(DJD)
407              
408             =item djd_to_rjdnn(DJD)
409              
410             =item djd_to_mjdnn(DJD)
411              
412             =item djd_to_djdnn(DJD)
413              
414             =item djd_to_tjdnn(DJD)
415              
416             =item djd_to_cjdnn(DJD, ZONE)
417              
418             =item djd_to_rdnn(DJD, ZONE)
419              
420             =item djd_to_ldnn(DJD, ZONE)
421              
422             =item tjd_to_jdnn(TJD)
423              
424             =item tjd_to_rjdnn(TJD)
425              
426             =item tjd_to_mjdnn(TJD)
427              
428             =item tjd_to_djdnn(TJD)
429              
430             =item tjd_to_tjdnn(TJD)
431              
432             =item tjd_to_cjdnn(TJD, ZONE)
433              
434             =item tjd_to_rdnn(TJD, ZONE)
435              
436             =item tjd_to_ldnn(TJD, ZONE)
437              
438             =item cjd_to_jdnn(CJD, ZONE)
439              
440             =item cjd_to_rjdnn(CJD, ZONE)
441              
442             =item cjd_to_mjdnn(CJD, ZONE)
443              
444             =item cjd_to_djdnn(CJD, ZONE)
445              
446             =item cjd_to_tjdnn(CJD, ZONE)
447              
448             =item cjd_to_cjdnn(CJD)
449              
450             =item cjd_to_rdnn(CJD)
451              
452             =item cjd_to_ldnn(CJD)
453              
454             =item rd_to_jdnn(RD, ZONE)
455              
456             =item rd_to_rjdnn(RD, ZONE)
457              
458             =item rd_to_mjdnn(RD, ZONE)
459              
460             =item rd_to_djdnn(RD, ZONE)
461              
462             =item rd_to_tjdnn(RD, ZONE)
463              
464             =item rd_to_cjdnn(RD)
465              
466             =item rd_to_rdnn(RD)
467              
468             =item rd_to_ldnn(RD)
469              
470             =item ld_to_jdnn(LD, ZONE)
471              
472             =item ld_to_rjdnn(LD, ZONE)
473              
474             =item ld_to_mjdnn(LD, ZONE)
475              
476             =item ld_to_djdnn(LD, ZONE)
477              
478             =item ld_to_tjdnn(LD, ZONE)
479              
480             =item ld_to_cjdnn(LD)
481              
482             =item ld_to_rdnn(LD)
483              
484             =item ld_to_ldnn(LD)
485              
486             These functions convert from a continuous day count to an integral day
487             count. The input identifies a point in time, as a continuous day count
488             of input flavour. The function returns the day number of output flavour
489             that applies at that instant. The process throws away information about
490             the time of (output-flavour) day.
491              
492             =item jd_to_jdnf(JD)
493              
494             =item jd_to_rjdnf(JD)
495              
496             =item jd_to_mjdnf(JD)
497              
498             =item jd_to_djdnf(JD)
499              
500             =item jd_to_tjdnf(JD)
501              
502             =item jd_to_cjdnf(JD, ZONE)
503              
504             =item jd_to_rdnf(JD, ZONE)
505              
506             =item jd_to_ldnf(JD, ZONE)
507              
508             =item rjd_to_jdnf(RJD)
509              
510             =item rjd_to_rjdnf(RJD)
511              
512             =item rjd_to_mjdnf(RJD)
513              
514             =item rjd_to_djdnf(RJD)
515              
516             =item rjd_to_tjdnf(RJD)
517              
518             =item rjd_to_cjdnf(RJD, ZONE)
519              
520             =item rjd_to_rdnf(RJD, ZONE)
521              
522             =item rjd_to_ldnf(RJD, ZONE)
523              
524             =item mjd_to_jdnf(MJD)
525              
526             =item mjd_to_rjdnf(MJD)
527              
528             =item mjd_to_mjdnf(MJD)
529              
530             =item mjd_to_djdnf(MJD)
531              
532             =item mjd_to_tjdnf(MJD)
533              
534             =item mjd_to_cjdnf(MJD, ZONE)
535              
536             =item mjd_to_rdnf(MJD, ZONE)
537              
538             =item mjd_to_ldnf(MJD, ZONE)
539              
540             =item djd_to_jdnf(DJD)
541              
542             =item djd_to_rjdnf(DJD)
543              
544             =item djd_to_mjdnf(DJD)
545              
546             =item djd_to_djdnf(DJD)
547              
548             =item djd_to_tjdnf(DJD)
549              
550             =item djd_to_cjdnf(DJD, ZONE)
551              
552             =item djd_to_rdnf(DJD, ZONE)
553              
554             =item djd_to_ldnf(DJD, ZONE)
555              
556             =item tjd_to_jdnf(TJD)
557              
558             =item tjd_to_rjdnf(TJD)
559              
560             =item tjd_to_mjdnf(TJD)
561              
562             =item tjd_to_djdnf(TJD)
563              
564             =item tjd_to_tjdnf(TJD)
565              
566             =item tjd_to_cjdnf(TJD, ZONE)
567              
568             =item tjd_to_rdnf(TJD, ZONE)
569              
570             =item tjd_to_ldnf(TJD, ZONE)
571              
572             =item cjd_to_jdnf(CJD, ZONE)
573              
574             =item cjd_to_rjdnf(CJD, ZONE)
575              
576             =item cjd_to_mjdnf(CJD, ZONE)
577              
578             =item cjd_to_djdnf(CJD, ZONE)
579              
580             =item cjd_to_tjdnf(CJD, ZONE)
581              
582             =item cjd_to_cjdnf(CJD)
583              
584             =item cjd_to_rdnf(CJD)
585              
586             =item cjd_to_ldnf(CJD)
587              
588             =item rd_to_jdnf(RD, ZONE)
589              
590             =item rd_to_rjdnf(RD, ZONE)
591              
592             =item rd_to_mjdnf(RD, ZONE)
593              
594             =item rd_to_djdnf(RD, ZONE)
595              
596             =item rd_to_tjdnf(RD, ZONE)
597              
598             =item rd_to_cjdnf(RD)
599              
600             =item rd_to_rdnf(RD)
601              
602             =item rd_to_ldnf(RD)
603              
604             =item ld_to_jdnf(LD, ZONE)
605              
606             =item ld_to_rjdnf(LD, ZONE)
607              
608             =item ld_to_mjdnf(LD, ZONE)
609              
610             =item ld_to_djdnf(LD, ZONE)
611              
612             =item ld_to_tjdnf(LD, ZONE)
613              
614             =item ld_to_cjdnf(LD)
615              
616             =item ld_to_rdnf(LD)
617              
618             =item ld_to_ldnf(LD)
619              
620             These functions convert from a continuous day count to an integral day
621             count with separate fraction. The input identifies a point in time,
622             as a continuous day count of input flavour. The function returns a
623             list of two items: the day number and fractional day of output flavour,
624             which together identify the same point in time as the input.
625              
626             =item jd_to_jdn(JD)
627              
628             =item jd_to_rjdn(JD)
629              
630             =item jd_to_mjdn(JD)
631              
632             =item jd_to_djdn(JD)
633              
634             =item jd_to_tjdn(JD)
635              
636             =item jd_to_cjdn(JD, ZONE)
637              
638             =item jd_to_rdn(JD, ZONE)
639              
640             =item jd_to_ldn(JD, ZONE)
641              
642             =item rjd_to_jdn(RJD)
643              
644             =item rjd_to_rjdn(RJD)
645              
646             =item rjd_to_mjdn(RJD)
647              
648             =item rjd_to_djdn(RJD)
649              
650             =item rjd_to_tjdn(RJD)
651              
652             =item rjd_to_cjdn(RJD, ZONE)
653              
654             =item rjd_to_rdn(RJD, ZONE)
655              
656             =item rjd_to_ldn(RJD, ZONE)
657              
658             =item mjd_to_jdn(MJD)
659              
660             =item mjd_to_rjdn(MJD)
661              
662             =item mjd_to_mjdn(MJD)
663              
664             =item mjd_to_djdn(MJD)
665              
666             =item mjd_to_tjdn(MJD)
667              
668             =item mjd_to_cjdn(MJD, ZONE)
669              
670             =item mjd_to_rdn(MJD, ZONE)
671              
672             =item mjd_to_ldn(MJD, ZONE)
673              
674             =item djd_to_jdn(DJD)
675              
676             =item djd_to_rjdn(DJD)
677              
678             =item djd_to_mjdn(DJD)
679              
680             =item djd_to_djdn(DJD)
681              
682             =item djd_to_tjdn(DJD)
683              
684             =item djd_to_cjdn(DJD, ZONE)
685              
686             =item djd_to_rdn(DJD, ZONE)
687              
688             =item djd_to_ldn(DJD, ZONE)
689              
690             =item tjd_to_jdn(TJD)
691              
692             =item tjd_to_rjdn(TJD)
693              
694             =item tjd_to_mjdn(TJD)
695              
696             =item tjd_to_djdn(TJD)
697              
698             =item tjd_to_tjdn(TJD)
699              
700             =item tjd_to_cjdn(TJD, ZONE)
701              
702             =item tjd_to_rdn(TJD, ZONE)
703              
704             =item tjd_to_ldn(TJD, ZONE)
705              
706             =item cjd_to_jdn(CJD, ZONE)
707              
708             =item cjd_to_rjdn(CJD, ZONE)
709              
710             =item cjd_to_mjdn(CJD, ZONE)
711              
712             =item cjd_to_djdn(CJD, ZONE)
713              
714             =item cjd_to_tjdn(CJD, ZONE)
715              
716             =item cjd_to_cjdn(CJD)
717              
718             =item cjd_to_rdn(CJD)
719              
720             =item cjd_to_ldn(CJD)
721              
722             =item rd_to_jdn(RD, ZONE)
723              
724             =item rd_to_rjdn(RD, ZONE)
725              
726             =item rd_to_mjdn(RD, ZONE)
727              
728             =item rd_to_djdn(RD, ZONE)
729              
730             =item rd_to_tjdn(RD, ZONE)
731              
732             =item rd_to_cjdn(RD)
733              
734             =item rd_to_rdn(RD)
735              
736             =item rd_to_ldn(RD)
737              
738             =item ld_to_jdn(LD, ZONE)
739              
740             =item ld_to_rjdn(LD, ZONE)
741              
742             =item ld_to_mjdn(LD, ZONE)
743              
744             =item ld_to_djdn(LD, ZONE)
745              
746             =item ld_to_tjdn(LD, ZONE)
747              
748             =item ld_to_cjdn(LD)
749              
750             =item ld_to_rdn(LD)
751              
752             =item ld_to_ldn(LD)
753              
754             These functions convert from a continuous day count to an integral day
755             count, possibly with separate fraction. The input identifies a point in
756             time, as a continuous day count of input flavour. If called in scalar
757             context, the function returns the day number of output flavour that
758             applies at that instant, throwing away information about the time of
759             (output-flavour) day. If called in list context, the function returns a
760             list of two items: the day number and fractional day of output flavour,
761             which together identify the same point in time as the input.
762              
763             These functions are not recommended, because the context-sensitive
764             return convention makes their use error-prone. They are retained for
765             backward compatibility. You should prefer to use the more specific
766             functions shown above.
767              
768             =item jdn_to_jd(JDN, JDF)
769              
770             =item jdn_to_rjd(JDN, JDF)
771              
772             =item jdn_to_mjd(JDN, JDF)
773              
774             =item jdn_to_djd(JDN, JDF)
775              
776             =item jdn_to_tjd(JDN, JDF)
777              
778             =item jdn_to_cjd(JDN, JDF, ZONE)
779              
780             =item jdn_to_rd(JDN, JDF, ZONE)
781              
782             =item jdn_to_ld(JDN, JDF, ZONE)
783              
784             =item rjdn_to_jd(RJDN, RJDF)
785              
786             =item rjdn_to_rjd(RJDN, RJDF)
787              
788             =item rjdn_to_mjd(RJDN, RJDF)
789              
790             =item rjdn_to_djd(RJDN, RJDF)
791              
792             =item rjdn_to_tjd(RJDN, RJDF)
793              
794             =item rjdn_to_cjd(RJDN, RJDF, ZONE)
795              
796             =item rjdn_to_rd(RJDN, RJDF, ZONE)
797              
798             =item rjdn_to_ld(RJDN, RJDF, ZONE)
799              
800             =item mjdn_to_jd(MJDN, MJDF)
801              
802             =item mjdn_to_rjd(MJDN, MJDF)
803              
804             =item mjdn_to_mjd(MJDN, MJDF)
805              
806             =item mjdn_to_djd(MJDN, MJDF)
807              
808             =item mjdn_to_tjd(MJDN, MJDF)
809              
810             =item mjdn_to_cjd(MJDN, MJDF, ZONE)
811              
812             =item mjdn_to_rd(MJDN, MJDF, ZONE)
813              
814             =item mjdn_to_ld(MJDN, MJDF, ZONE)
815              
816             =item djdn_to_jd(DJDN, DJDF)
817              
818             =item djdn_to_rjd(DJDN, DJDF)
819              
820             =item djdn_to_mjd(DJDN, DJDF)
821              
822             =item djdn_to_djd(DJDN, DJDF)
823              
824             =item djdn_to_tjd(DJDN, DJDF)
825              
826             =item djdn_to_cjd(DJDN, DJDF, ZONE)
827              
828             =item djdn_to_rd(DJDN, DJDF, ZONE)
829              
830             =item djdn_to_ld(DJDN, DJDF, ZONE)
831              
832             =item tjdn_to_jd(TJDN, TJDF)
833              
834             =item tjdn_to_rjd(TJDN, TJDF)
835              
836             =item tjdn_to_mjd(TJDN, TJDF)
837              
838             =item tjdn_to_djd(TJDN, TJDF)
839              
840             =item tjdn_to_tjd(TJDN, TJDF)
841              
842             =item tjdn_to_cjd(TJDN, TJDF, ZONE)
843              
844             =item tjdn_to_rd(TJDN, TJDF, ZONE)
845              
846             =item tjdn_to_ld(TJDN, TJDF, ZONE)
847              
848             =item cjdn_to_jd(CJDN, CJDF, ZONE)
849              
850             =item cjdn_to_rjd(CJDN, CJDF, ZONE)
851              
852             =item cjdn_to_mjd(CJDN, CJDF, ZONE)
853              
854             =item cjdn_to_djd(CJDN, CJDF, ZONE)
855              
856             =item cjdn_to_tjd(CJDN, CJDF, ZONE)
857              
858             =item cjdn_to_cjd(CJDN, CJDF)
859              
860             =item cjdn_to_rd(CJDN, CJDF)
861              
862             =item cjdn_to_ld(CJDN, CJDF)
863              
864             =item rdn_to_jd(RDN, RDF, ZONE)
865              
866             =item rdn_to_rjd(RDN, RDF, ZONE)
867              
868             =item rdn_to_mjd(RDN, RDF, ZONE)
869              
870             =item rdn_to_djd(RDN, RDF, ZONE)
871              
872             =item rdn_to_tjd(RDN, RDF, ZONE)
873              
874             =item rdn_to_cjd(RDN, RDF)
875              
876             =item rdn_to_rd(RDN, RDF)
877              
878             =item rdn_to_ld(RDN, RDF)
879              
880             =item ldn_to_jd(LDN, LDF, ZONE)
881              
882             =item ldn_to_rjd(LDN, LDF, ZONE)
883              
884             =item ldn_to_mjd(LDN, LDF, ZONE)
885              
886             =item ldn_to_djd(LDN, LDF, ZONE)
887              
888             =item ldn_to_tjd(LDN, LDF, ZONE)
889              
890             =item ldn_to_cjd(LDN, LDF)
891              
892             =item ldn_to_rd(LDN, LDF)
893              
894             =item ldn_to_ld(LDN, LDF)
895              
896             These functions convert from an integral day count with separate fraction
897             to a continuous day count. The input identifies a point in time, as
898             an integral day number of input flavour plus day fraction in the range
899             [0, 1). The function returns the same point in time, represented as a
900             continuous day count of output flavour.
901              
902             =item jdn_to_jdnn(JDN[, JDF])
903              
904             =item jdn_to_rjdnn(JDN[, JDF])
905              
906             =item jdn_to_mjdnn(JDN, JDF)
907              
908             =item jdn_to_djdnn(JDN[, JDF])
909              
910             =item jdn_to_tjdnn(JDN, JDF)
911              
912             =item jdn_to_cjdnn(JDN, JDF, ZONE)
913              
914             =item jdn_to_rdnn(JDN, JDF, ZONE)
915              
916             =item jdn_to_ldnn(JDN, JDF, ZONE)
917              
918             =item rjdn_to_jdnn(RJDN[, RJDF])
919              
920             =item rjdn_to_rjdnn(RJDN[, RJDF])
921              
922             =item rjdn_to_mjdnn(RJDN, RJDF)
923              
924             =item rjdn_to_djdnn(RJDN[, RJDF])
925              
926             =item rjdn_to_tjdnn(RJDN, RJDF)
927              
928             =item rjdn_to_cjdnn(RJDN, RJDF, ZONE)
929              
930             =item rjdn_to_rdnn(RJDN, RJDF, ZONE)
931              
932             =item rjdn_to_ldnn(RJDN, RJDF, ZONE)
933              
934             =item mjdn_to_jdnn(MJDN, MJDF)
935              
936             =item mjdn_to_rjdnn(MJDN, MJDF)
937              
938             =item mjdn_to_mjdnn(MJDN[, MJDF])
939              
940             =item mjdn_to_djdnn(MJDN, MJDF)
941              
942             =item mjdn_to_tjdnn(MJDN[, MJDF])
943              
944             =item mjdn_to_cjdnn(MJDN, MJDF, ZONE)
945              
946             =item mjdn_to_rdnn(MJDN, MJDF, ZONE)
947              
948             =item mjdn_to_ldnn(MJDN, MJDF, ZONE)
949              
950             =item djdn_to_jdnn(DJDN[, DJDF])
951              
952             =item djdn_to_rjdnn(DJDN[, DJDF])
953              
954             =item djdn_to_mjdnn(DJDN, DJDF)
955              
956             =item djdn_to_djdnn(DJDN[, DJDF])
957              
958             =item djdn_to_tjdnn(DJDN, DJDF)
959              
960             =item djdn_to_cjdnn(DJDN, DJDF, ZONE)
961              
962             =item djdn_to_rdnn(DJDN, DJDF, ZONE)
963              
964             =item djdn_to_ldnn(DJDN, DJDF, ZONE)
965              
966             =item tjdn_to_jdnn(TJDN, TJDF)
967              
968             =item tjdn_to_rjdnn(TJDN, TJDF)
969              
970             =item tjdn_to_mjdnn(TJDN[, TJDF])
971              
972             =item tjdn_to_djdnn(TJDN, TJDF)
973              
974             =item tjdn_to_tjdnn(TJDN[, TJDF])
975              
976             =item tjdn_to_cjdnn(TJDN, TJDF, ZONE)
977              
978             =item tjdn_to_rdnn(TJDN, TJDF, ZONE)
979              
980             =item tjdn_to_ldnn(TJDN, TJDF, ZONE)
981              
982             =item cjdn_to_jdnn(CJDN, CJDF, ZONE)
983              
984             =item cjdn_to_rjdnn(CJDN, CJDF, ZONE)
985              
986             =item cjdn_to_mjdnn(CJDN, CJDF, ZONE)
987              
988             =item cjdn_to_djdnn(CJDN, CJDF, ZONE)
989              
990             =item cjdn_to_tjdnn(CJDN, CJDF, ZONE)
991              
992             =item cjdn_to_cjdnn(CJDN[, CJDF])
993              
994             =item cjdn_to_rdnn(CJDN[, CJDF])
995              
996             =item cjdn_to_ldnn(CJDN[, CJDF])
997              
998             =item rdn_to_jdnn(RDN, RDF, ZONE)
999              
1000             =item rdn_to_rjdnn(RDN, RDF, ZONE)
1001              
1002             =item rdn_to_mjdnn(RDN, RDF, ZONE)
1003              
1004             =item rdn_to_djdnn(RDN, RDF, ZONE)
1005              
1006             =item rdn_to_tjdnn(RDN, RDF, ZONE)
1007              
1008             =item rdn_to_cjdnn(RDN[, RDF])
1009              
1010             =item rdn_to_rdnn(RDN[, RDF])
1011              
1012             =item rdn_to_ldnn(RDN[, RDF])
1013              
1014             =item ldn_to_jdnn(LDN, LDF, ZONE)
1015              
1016             =item ldn_to_rjdnn(LDN, LDF, ZONE)
1017              
1018             =item ldn_to_mjdnn(LDN, LDF, ZONE)
1019              
1020             =item ldn_to_djdnn(LDN, LDF, ZONE)
1021              
1022             =item ldn_to_tjdnn(LDN, LDF, ZONE)
1023              
1024             =item ldn_to_cjdnn(LDN[, LDF])
1025              
1026             =item ldn_to_rdnn(LDN[, LDF])
1027              
1028             =item ldn_to_ldnn(LDN[, LDF])
1029              
1030             These functions convert from an integral day count with separate fraction
1031             to an integral day count. The input identifies a point in time, as an
1032             integral day number of input flavour plus day fraction in the range
1033             [0, 1). The function returns the day number of output flavour that
1034             applies at that instant. The process throws away information about
1035             the time of (output-flavour) day. If converting between systems that
1036             delimit days identically (e.g., between JD and RJD), the day fraction
1037             makes no difference and may be omitted from the input.
1038              
1039             =item jdn_to_jdnf(JDN, JDF)
1040              
1041             =item jdn_to_rjdnf(JDN, JDF)
1042              
1043             =item jdn_to_mjdnf(JDN, JDF)
1044              
1045             =item jdn_to_djdnf(JDN, JDF)
1046              
1047             =item jdn_to_tjdnf(JDN, JDF)
1048              
1049             =item jdn_to_cjdnf(JDN, JDF, ZONE)
1050              
1051             =item jdn_to_rdnf(JDN, JDF, ZONE)
1052              
1053             =item jdn_to_ldnf(JDN, JDF, ZONE)
1054              
1055             =item rjdn_to_jdnf(RJDN, RJDF)
1056              
1057             =item rjdn_to_rjdnf(RJDN, RJDF)
1058              
1059             =item rjdn_to_mjdnf(RJDN, RJDF)
1060              
1061             =item rjdn_to_djdnf(RJDN, RJDF)
1062              
1063             =item rjdn_to_tjdnf(RJDN, RJDF)
1064              
1065             =item rjdn_to_cjdnf(RJDN, RJDF, ZONE)
1066              
1067             =item rjdn_to_rdnf(RJDN, RJDF, ZONE)
1068              
1069             =item rjdn_to_ldnf(RJDN, RJDF, ZONE)
1070              
1071             =item mjdn_to_jdnf(MJDN, MJDF)
1072              
1073             =item mjdn_to_rjdnf(MJDN, MJDF)
1074              
1075             =item mjdn_to_mjdnf(MJDN, MJDF)
1076              
1077             =item mjdn_to_djdnf(MJDN, MJDF)
1078              
1079             =item mjdn_to_tjdnf(MJDN, MJDF)
1080              
1081             =item mjdn_to_cjdnf(MJDN, MJDF, ZONE)
1082              
1083             =item mjdn_to_rdnf(MJDN, MJDF, ZONE)
1084              
1085             =item mjdn_to_ldnf(MJDN, MJDF, ZONE)
1086              
1087             =item djdn_to_jdnf(DJDN, DJDF)
1088              
1089             =item djdn_to_rjdnf(DJDN, DJDF)
1090              
1091             =item djdn_to_mjdnf(DJDN, DJDF)
1092              
1093             =item djdn_to_djdnf(DJDN, DJDF)
1094              
1095             =item djdn_to_tjdnf(DJDN, DJDF)
1096              
1097             =item djdn_to_cjdnf(DJDN, DJDF, ZONE)
1098              
1099             =item djdn_to_rdnf(DJDN, DJDF, ZONE)
1100              
1101             =item djdn_to_ldnf(DJDN, DJDF, ZONE)
1102              
1103             =item tjdn_to_jdnf(TJDN, TJDF)
1104              
1105             =item tjdn_to_rjdnf(TJDN, TJDF)
1106              
1107             =item tjdn_to_mjdnf(TJDN, TJDF)
1108              
1109             =item tjdn_to_djdnf(TJDN, TJDF)
1110              
1111             =item tjdn_to_tjdnf(TJDN, TJDF)
1112              
1113             =item tjdn_to_cjdnf(TJDN, TJDF, ZONE)
1114              
1115             =item tjdn_to_rdnf(TJDN, TJDF, ZONE)
1116              
1117             =item tjdn_to_ldnf(TJDN, TJDF, ZONE)
1118              
1119             =item cjdn_to_jdnf(CJDN, CJDF, ZONE)
1120              
1121             =item cjdn_to_rjdnf(CJDN, CJDF, ZONE)
1122              
1123             =item cjdn_to_mjdnf(CJDN, CJDF, ZONE)
1124              
1125             =item cjdn_to_djdnf(CJDN, CJDF, ZONE)
1126              
1127             =item cjdn_to_tjdnf(CJDN, CJDF, ZONE)
1128              
1129             =item cjdn_to_cjdnf(CJDN, CJDF)
1130              
1131             =item cjdn_to_rdnf(CJDN, CJDF)
1132              
1133             =item cjdn_to_ldnf(CJDN, CJDF)
1134              
1135             =item rdn_to_jdnf(RDN, RDF, ZONE)
1136              
1137             =item rdn_to_rjdnf(RDN, RDF, ZONE)
1138              
1139             =item rdn_to_mjdnf(RDN, RDF, ZONE)
1140              
1141             =item rdn_to_djdnf(RDN, RDF, ZONE)
1142              
1143             =item rdn_to_tjdnf(RDN, RDF, ZONE)
1144              
1145             =item rdn_to_cjdnf(RDN, RDF)
1146              
1147             =item rdn_to_rdnf(RDN, RDF)
1148              
1149             =item rdn_to_ldnf(RDN, RDF)
1150              
1151             =item ldn_to_jdnf(LDN, LDF, ZONE)
1152              
1153             =item ldn_to_rjdnf(LDN, LDF, ZONE)
1154              
1155             =item ldn_to_mjdnf(LDN, LDF, ZONE)
1156              
1157             =item ldn_to_djdnf(LDN, LDF, ZONE)
1158              
1159             =item ldn_to_tjdnf(LDN, LDF, ZONE)
1160              
1161             =item ldn_to_cjdnf(LDN, LDF)
1162              
1163             =item ldn_to_rdnf(LDN, LDF)
1164              
1165             =item ldn_to_ldnf(LDN, LDF)
1166              
1167             These functions convert from one integral day count with separate
1168             fraction to another. The input identifies a point in time, as an
1169             integral day number of input flavour plus day fraction in the range
1170             [0, 1). The function returns a list of two items: the day number and
1171             fractional day of output flavour, which together identify the same point
1172             in time as the input.
1173              
1174             =item jdn_to_jdn(JDN[, JDF])
1175              
1176             =item jdn_to_rjdn(JDN[, JDF])
1177              
1178             =item jdn_to_mjdn(JDN, JDF)
1179              
1180             =item jdn_to_djdn(JDN[, JDF])
1181              
1182             =item jdn_to_tjdn(JDN, JDF)
1183              
1184             =item jdn_to_cjdn(JDN, JDF, ZONE)
1185              
1186             =item jdn_to_rdn(JDN, JDF, ZONE)
1187              
1188             =item jdn_to_ldn(JDN, JDF, ZONE)
1189              
1190             =item rjdn_to_jdn(RJDN[, RJDF])
1191              
1192             =item rjdn_to_rjdn(RJDN[, RJDF])
1193              
1194             =item rjdn_to_mjdn(RJDN, RJDF)
1195              
1196             =item rjdn_to_djdn(RJDN[, RJDF])
1197              
1198             =item rjdn_to_tjdn(RJDN, RJDF)
1199              
1200             =item rjdn_to_cjdn(RJDN, RJDF, ZONE)
1201              
1202             =item rjdn_to_rdn(RJDN, RJDF, ZONE)
1203              
1204             =item rjdn_to_ldn(RJDN, RJDF, ZONE)
1205              
1206             =item mjdn_to_jdn(MJDN, MJDF)
1207              
1208             =item mjdn_to_rjdn(MJDN, MJDF)
1209              
1210             =item mjdn_to_mjdn(MJDN[, MJDF])
1211              
1212             =item mjdn_to_djdn(MJDN, MJDF)
1213              
1214             =item mjdn_to_tjdn(MJDN[, MJDF])
1215              
1216             =item mjdn_to_cjdn(MJDN, MJDF, ZONE)
1217              
1218             =item mjdn_to_rdn(MJDN, MJDF, ZONE)
1219              
1220             =item mjdn_to_ldn(MJDN, MJDF, ZONE)
1221              
1222             =item djdn_to_jdn(DJDN[, DJDF])
1223              
1224             =item djdn_to_rjdn(DJDN[, DJDF])
1225              
1226             =item djdn_to_mjdn(DJDN, DJDF)
1227              
1228             =item djdn_to_djdn(DJDN[, DJDF])
1229              
1230             =item djdn_to_tjdn(DJDN, DJDF)
1231              
1232             =item djdn_to_cjdn(DJDN, DJDF, ZONE)
1233              
1234             =item djdn_to_rdn(DJDN, DJDF, ZONE)
1235              
1236             =item djdn_to_ldn(DJDN, DJDF, ZONE)
1237              
1238             =item tjdn_to_jdn(TJDN, TJDF)
1239              
1240             =item tjdn_to_rjdn(TJDN, TJDF)
1241              
1242             =item tjdn_to_mjdn(TJDN[, TJDF])
1243              
1244             =item tjdn_to_djdn(TJDN, TJDF)
1245              
1246             =item tjdn_to_tjdn(TJDN[, TJDF])
1247              
1248             =item tjdn_to_cjdn(TJDN, TJDF, ZONE)
1249              
1250             =item tjdn_to_rdn(TJDN, TJDF, ZONE)
1251              
1252             =item tjdn_to_ldn(TJDN, TJDF, ZONE)
1253              
1254             =item cjdn_to_jdn(CJDN, CJDF, ZONE)
1255              
1256             =item cjdn_to_rjdn(CJDN, CJDF, ZONE)
1257              
1258             =item cjdn_to_mjdn(CJDN, CJDF, ZONE)
1259              
1260             =item cjdn_to_djdn(CJDN, CJDF, ZONE)
1261              
1262             =item cjdn_to_tjdn(CJDN, CJDF, ZONE)
1263              
1264             =item cjdn_to_cjdn(CJDN[, CJDF])
1265              
1266             =item cjdn_to_rdn(CJDN[, CJDF])
1267              
1268             =item cjdn_to_ldn(CJDN[, CJDF])
1269              
1270             =item rdn_to_jdn(RDN, RDF, ZONE)
1271              
1272             =item rdn_to_rjdn(RDN, RDF, ZONE)
1273              
1274             =item rdn_to_mjdn(RDN, RDF, ZONE)
1275              
1276             =item rdn_to_djdn(RDN, RDF, ZONE)
1277              
1278             =item rdn_to_tjdn(RDN, RDF, ZONE)
1279              
1280             =item rdn_to_cjdn(RDN[, RDF])
1281              
1282             =item rdn_to_rdn(RDN[, RDF])
1283              
1284             =item rdn_to_ldn(RDN[, RDF])
1285              
1286             =item ldn_to_jdn(LDN, LDF, ZONE)
1287              
1288             =item ldn_to_rjdn(LDN, LDF, ZONE)
1289              
1290             =item ldn_to_mjdn(LDN, LDF, ZONE)
1291              
1292             =item ldn_to_djdn(LDN, LDF, ZONE)
1293              
1294             =item ldn_to_tjdn(LDN, LDF, ZONE)
1295              
1296             =item ldn_to_cjdn(LDN[, LDF])
1297              
1298             =item ldn_to_rdn(LDN[, LDF])
1299              
1300             =item ldn_to_ldn(LDN[, LDF])
1301              
1302             These functions convert from an integral day count with separate fraction
1303             to an integral day count, possibly with separate fraction. The input
1304             identifies a point in time, as an integral day number of input flavour
1305             plus day fraction in the range [0, 1). If called in scalar context, the
1306             function returns the day number of output flavour that applies at that
1307             instant, throwing away information about the time of (output-flavour) day.
1308             If called in list context, the function returns a list of two items:
1309             the day number and fractional day of output flavour, which together
1310             identify the same point in time as the input.
1311              
1312             If converting between systems that delimit days identically (e.g.,
1313             between JD and RJD), the day fraction makes no difference to the integral
1314             day number of the output, and may be omitted from the input. If the day
1315             fraction is extracted from the output when it wasn't supplied as input,
1316             it will default to zero.
1317              
1318             These functions are not recommended, because the context-sensitive
1319             return convention makes their use error-prone. They are retained for
1320             backward compatibility. You should prefer to use the more specific
1321             functions shown above.
1322              
1323             =cut
1324              
1325             eval { local $SIG{__DIE__};
1326             require POSIX;
1327             *_floor = \&POSIX::floor;
1328             };
1329             if($@ ne "") {
1330             *_floor = sub($) {
1331             my $i = int($_[0]);
1332             return $i == $_[0] || $_[0] > 0 ? $i : $i - 1;
1333             }
1334             }
1335              
1336             sub _check_dn($$) {
1337 3584 100   3584   22193 croak "purported day number $_[0] is not an integer"
    50          
1338             unless ref($_[0]) ? $_[0]->is_int : $_[0] == int($_[0]);
1339 3584 50 33     88760 croak "purported day fraction $_[1] is out of range [0, 1)"
1340             unless $_[1] >= 0 && $_[1] < 1;
1341             }
1342              
1343             sub _ret_dnn($) {
1344 7168 100   7168   1012803 my $dn = ref($_[0]) eq "Math::BigRat" ?
1345             $_[0]->copy->bfloor : _floor($_[0]);
1346 7168         212691 return $dn;
1347             }
1348              
1349             sub _ret_dnf($) {
1350 2048     2048   498245 my $dn = &_ret_dnn;
1351 2048         9731 return ($dn, $_[0] - $dn);
1352             }
1353              
1354             sub _ret_dn($) {
1355 2048     2048   1022005 my $dn = &_ret_dnn;
1356 2048 100       7059 return wantarray ? &_ret_dnf : &_ret_dnn;
1357             }
1358              
1359             foreach my $src (keys %jd_flavours) { foreach my $dst (keys %jd_flavours) {
1360             my $ediff = $jd_flavours{$src}->{epoch_jd} -
1361             $jd_flavours{$dst}->{epoch_jd};
1362             my $ediffh = $ediff == int($ediff) ? 0 : 0.5;
1363             my $ediffi = $ediff - $ediffh;
1364             my $src_zone = !!$jd_flavours{$src}->{zone};
1365             my $dst_zone = !!$jd_flavours{$dst}->{zone};
1366             my($zp, $z1, $z2);
1367             if($src_zone == $dst_zone) {
1368             $zp = $z1 = $z2 = "";
1369             } else {
1370             $zp = "\$";
1371             my $zsign = $src_zone ? "-" : "+";
1372             $z1 = "$zsign \$_[1]";
1373             $z2 = "$zsign \$_[2]";
1374             }
1375 16     16 1 21943 eval "sub ${src}_to_${dst}(\$${zp}) { \$_[0] + (${ediff}) ${z1} }";
  16     16 1 25758  
  16     16 1 26403  
  16     16 1 22325  
  16     16 1 23889  
  16     16 1 27086  
  16     16 1 26797  
  16     16 1 25616  
  16     16 1 24828  
  16     16 1 19425  
  16     16 1 20462  
  16     16 1 24711  
  16     16 1 21771  
  16     16 1 23977  
  16     16 1 28449  
  16     16 1 25434  
  16     16 1 26385  
  16     16 1 48046  
  16     16 1 28489  
  16     16 1 28253  
  16     16 1 23002  
  16     16 1 24209  
  16     16 1 21262  
  16     16 1 30136  
  16     16 1 30757  
  16     16 1 24983  
  16     16 1 26919  
  16     16 1 28024  
  16     16 1 34865  
  16     16 1 21775  
  16     16 1 45946  
  16     16 1 27865  
  16     16 1 28495  
  16     16 1 28587  
  16     16 1 28718  
  16     16 1 34646  
  16     16 1 20497  
  16     16 1 26638  
  16     16 1 23549  
  16     16 1 21534  
  16     16 1 21304  
  16     16 1 26428  
  16     16 1 36125  
  16     16 1 23685  
  16     16 1 26230  
  16     16 1 25558  
  16     16 1 33594  
  16     16 1 28256  
  16     16 1 24575  
  16     16 1 22873  
  16     16 1 29007  
  16     16 1 28907  
  16     16 1 25836  
  16     16 1 29426  
  16     16 1 21393  
  16     16 1 28818  
  16     16 1 22337  
  16     16 1 22291  
  16     16 1 20546  
  16     16 1 23979  
  16     16 1 20701  
  16     16 1 21407  
  16     16 1 34474  
  16     16 1 113108  
1376             push @EXPORT_OK, "${src}_to_${dst}";
1377 16     16 1 10246 eval "sub ${src}_to_${dst}nn(\$${zp}) {
  16     16 1 13702  
  16     16 1 13153  
  16     16 1 10346  
  16     16 1 11735  
  16     16 1 10805  
  16     16 1 18467  
  16     16 1 13096  
  16     16 1 19521  
  16     16 1 16041  
  16     16 1 18247  
  16     16 1 12154  
  16     16 1 10229  
  16     16 1 12075  
  16     16 1 11204  
  16     16 1 11169  
  16     16 1 13415  
  16     16 1 12330  
  16     16 1 10173  
  16     16 1 14762  
  16     16 1 10397  
  16     16 1 12643  
  16     16 1 8723  
  16     16 1 14484  
  16     16 1 10592  
  16     16 1 13147  
  16     16 1 15172  
  16     16 1 9809  
  16     16 1 13179  
  16     16 1 9599  
  16     16 1 24588  
  16     16 1 13453  
  16     16 1 13912  
  16     16 1 19155  
  16     16 1 15395  
  16     16 1 14676  
  16     16 1 9511  
  16     16 1 13512  
  16     16 1 11910  
  16     16 1 18283  
  16     16 1 9099  
  16     16 1 13613  
  16     16 1 15192  
  16     16 1 11288  
  16     16 1 12449  
  16     16 1 11836  
  16     16 1 13120  
  16     16 1 15698  
  16     16 1 12775  
  16     16 1 9190  
  16     16 1 10312  
  16     16 1 12879  
  16     16 1 17711  
  16     16 1 22618  
  16     16 1 9201  
  16     16 1 13559  
  16     16 1 16612  
  16     16 1 10453  
  16     16 1 10275  
  16     16 1 12407  
  16     16 1 9077  
  16     16 1 10159  
  16     16 1 12198  
  16     16 1 9624  
1378             _ret_dnn(\$_[0] + (${ediff}) ${z1})
1379             }";
1380             push @EXPORT_OK, "${src}_to_${dst}nn";
1381 8     8 1 8241 eval "sub ${src}_to_${dst}nf(\$${zp}) {
  8     8 1 8167  
  8     8 1 7616  
  8     8 1 7752  
  8     8 1 7425  
  8     8 1 8034  
  8     8 1 7683  
  8     8 1 9142  
  8     8 1 8670  
  8     8 1 7954  
  8     8 1 7535  
  8     8 1 7575  
  8     8 1 7247  
  8     8 1 10716  
  8     8 1 9469  
  8     8 1 7429  
  8     8 1 10988  
  8     8 1 9512  
  8     8 1 8056  
  8     8 1 9100  
  8     8 1 7953  
  8     8 1 7905  
  8     8 1 8787  
  8     8 1 11477  
  8     8 1 8786  
  8     8 1 8450  
  8     8 1 8041  
  8     8 1 7972  
  8     8 1 7800  
  8     8 1 10065  
  8     8 1 8433  
  8     8 1 9295  
  8     8 1 8949  
  8     8 1 9450  
  8     8 1 14128  
  8     8 1 10658  
  8     8 1 8220  
  8     8 1 8411  
  8     8 1 9889  
  8     8 1 6972  
  8     8 1 7135  
  8     8 1 7573  
  8     8 1 10230  
  8     8 1 8743  
  8     8 1 7468  
  8     8 1 12756  
  8     8 1 7780  
  8     8 1 8357  
  8     8 1 7960  
  8     8 1 7824  
  8     8 1 7858  
  8     8 1 9504  
  8     8 1 8395  
  8     8 1 9612  
  8     8 1 7959  
  8     8 1 10220  
  8     8 1 7629  
  8     8 1 7851  
  8     8 1 6421  
  8     8 1 7402  
  8     8 1 15019  
  8     8 1 6484  
  8     8 1 25677  
  8     8 1 8311  
1382             _ret_dnf(\$_[0] + (${ediff}) ${z1})
1383             }";
1384             push @EXPORT_OK, "${src}_to_${dst}nf";
1385 16     16 1 27548 eval "sub ${src}_to_${dst}n(\$${zp}) {
  16     16 1 22301  
  16     16 1 27620  
  16     16 1 20438  
  16     16 1 22674  
  16     16 1 25688  
  16     16 1 21902  
  16     16 1 28544  
  16     16 1 21532  
  16     16 1 19562  
  16     16 1 20942  
  16     16 1 21722  
  16     16 1 28749  
  16     16 1 20179  
  16     16 1 23622  
  16     16 1 22696  
  16     16 1 24829  
  16     16 1 23429  
  16     16 1 20531  
  16     16 1 24415  
  16     16 1 21494  
  16     16 1 19183  
  16     16 1 25450  
  16     16 1 38480  
  16     16 1 24228  
  16     16 1 29044  
  16     16 1 20354  
  16     16 1 22164  
  16     16 1 27361  
  16     16 1 26719  
  16     16 1 28681  
  16     16 1 26312  
  16     16 1 23031  
  16     16 1 22845  
  16     16 1 28007  
  16     16 1 26953  
  16     16 1 20612  
  16     16 1 23841  
  16     16 1 22296  
  16     16 1 25316  
  16     16 1 20429  
  16     16 1 37986  
  16     16 1 30249  
  16     16 1 31696  
  16     16 1 21307  
  16     16 1 28259  
  16     16 1 23563  
  16     16 1 21657  
  16     16 1 22461  
  16     16 1 23606  
  16     16 1 25833  
  16     16 1 27797  
  16     16 1 27250  
  16     16 1 25725  
  16     16 1 25880  
  16     16 1 25083  
  16     16 1 25687  
  16     16 1 21945  
  16     16 1 20401  
  16     16 1 19795  
  16     16 1 19738  
  16     16 1 18425  
  16     16 1 24097  
  16     16 1 28324  
1386             _ret_dn(\$_[0] + (${ediff}) ${z1})
1387             }";
1388             push @EXPORT_OK, "${src}_to_${dst}n";
1389 16     16 1 24917 eval "sub ${src}n_to_${dst}(\$\$${zp}) {
  16     16 1 3132  
  16     16 1 21982  
  16     16 1 2816  
  16     16 1 23824  
  16     16 1 3671  
  16     16 1 20031  
  16     16 1 3200  
  16     16 1 24308  
  16     16 1 3313  
  16     16 1 20345  
  16     16 1 3282  
  16     16 1 23739  
  16     16 1 3463  
  16     16 1 23202  
  16     16 1 2968  
  16     16 1 24327  
  16     16 1 3446  
  16     16 1 21325  
  16     16 1 3396  
  16     16 1 21793  
  16     16 1 3117  
  16     16 1 26650  
  16     16 1 3454  
  16     16 1 24219  
  16     16 1 3510  
  16     16 1 22111  
  16     16 1 2890  
  16     16 1 22728  
  16     16 1 3400  
  16     16 1 22070  
  16     16 1 3685  
  16     16 1 31735  
  16     16 1 3759  
  16     16 1 27645  
  16     16 1 3453  
  16     16 1 18869  
  16     16 1 3005  
  16     16 1 24536  
  16     16 1 3761  
  16     16 1 27849  
  16     16 1 4282  
  16     16 1 21907  
  16     16 1 3196  
  16     16 1 47129  
  16     16 1 3404  
  16     16 1 32917  
  16     16 1 4621  
  16     16 1 21453  
  16     16 1 4193  
  16     16 1 26485  
  16     16 1 3602  
  16     16 1 21607  
  16     16 1 3011  
  16     16 1 20846  
  16     16 1 3294  
  16     16 1 22948  
  16     16 1 2867  
  16     16 1 18796  
  16     16 1 3068  
  16     16 1 27090  
  16     16 1 3477  
  16     16 1 24191  
  16     16 1 3161  
  16         23506  
  16         3481  
  16         20948  
  16         3006  
  16         32215  
  16         3606  
  16         26464  
  16         3645  
  16         19203  
  16         3065  
  16         25241  
  16         3029  
  16         24650  
  16         5847  
  16         18598  
  16         3142  
  16         19250  
  16         3283  
  16         36482  
  16         3251  
  16         26364  
  16         3169  
  16         28156  
  16         3562  
  16         22365  
  16         2973  
  16         20956  
  16         3167  
  16         30171  
  16         4096  
  16         24064  
  16         3213  
  16         23312  
  16         3116  
  16         20904  
  16         3512  
  16         25228  
  16         3179  
  16         24963  
  16         2916  
  16         27557  
  16         3860  
  16         24086  
  16         15493  
  16         19747  
  16         3046  
  16         31952  
  16         3252  
  16         25604  
  16         3025  
  16         19271  
  16         2839  
  16         18200  
  16         2996  
  16         21972  
  16         3731  
  16         18938  
  16         3389  
  16         20361  
  16         2964  
  16         41188  
  16         3319  
  16         19668  
  16         4116  
1390             _check_dn(\$_[0], \$_[1]);
1391             \$_[0] + \$_[1] + (${ediff}) ${z2}
1392             }";
1393             push @EXPORT_OK, "${src}n_to_${dst}";
1394             my($tp, $tc);
1395             if($ediffh == 0 && $src_zone == $dst_zone) {
1396             $tp = ";";
1397             $tc = "push \@_, 0 if \@_ == 1;";
1398             } else {
1399             $tp = $tc = "";
1400             }
1401 16 50   16 1 13746 eval "sub ${src}n_to_${dst}nn(\$${tp}\$${zp}) { $tc
  16 50   16 1 62  
  16 50   16 1 3131  
  16 50   16 1 16574  
  16 50   16 1 2966  
  16 50   16 1 18481  
  16 50   16 1 3208  
  16 50   16 1 15312  
  16 50   16 1 106  
  16 50   16 1 3524  
  16 50   16 1 18640  
  16 50   16 1 3693  
  16 50   16 1 13824  
  16 50   16 1 57  
  16 50   16 1 3131  
  16 50   16 1 17864  
  16 50   16 1 3161  
  16 50   16 1 15861  
  16 50   16 1 2791  
  16 50   16 1 20209  
  16 50   16 1 3240  
  16 50   16 1 11879  
  16     16 1 67  
  16     16 1 2870  
  16     16 1 13819  
  16     16 1 53  
  16     16 1 3065  
  16     16 1 17868  
  16     16 1 3356  
  16     16 1 14526  
  16     16 1 3279  
  16     16 1 18888  
  16     16 1 3071  
  16     16 1 14184  
  16     16 1 61  
  16     16 1 2965  
  16     16 1 23277  
  16     16 1 3270  
  16     16 1 23641  
  16     16 1 3759  
  16     16 1 25511  
  16     16 1 70  
  16     16 1 3155  
  16     16 1 13997  
  16     16 1 68  
  16     16 1 3085  
  16     16 1 18640  
  16     16 1 3184  
  16     16 1 20224  
  16     16 1 3811  
  16     16 1 16668  
  16     16 1 3050  
  16     16 1 17773  
  16     16 1 67  
  16     16 1 3543  
  16     16 1 21491  
  16     16 1 3222  
  16     16 1 16250  
  16     16 1 70  
  16     16 1 3704  
  16     16 1 19525  
  16     16 1 4305  
  16     16 1 18480  
  16     16 1 3024  
  16         14011  
  16         65  
  16         3041  
  16         22095  
  16         3126  
  16         13264  
  16         68  
  16         2982  
  16         20638  
  16         3306  
  16         19631  
  16         9262  
  16         28421  
  16         3902  
  16         15213  
  16         2769  
  16         22480  
  16         3401  
  16         23684  
  16         4316  
  16         13962  
  16         71  
  16         2919  
  16         23226  
  16         3318  
  16         16322  
  16         3135  
  16         13414  
  16         57  
  16         2973  
  16         13645  
  16         60  
  16         3504  
  16         17604  
  16         3872  
  16         22024  
  16         3078  
  16         16367  
  16         218  
  16         3168  
  16         16100  
  16         3207  
  16         22921  
  16         66  
  16         3561  
  16         25570  
  16         6109  
  16         17408  
  16         2923  
  16         18051  
  16         3063  
  16         14004  
  16         66  
  16         2836  
  16         15695  
  16         90  
  16         3409  
  16         19000  
  16         3059  
  16         16595  
  16         3202  
  16         28393  
  16         3080  
  16         13939  
  16         60  
  16         2891  
  16         16767  
  16         3233  
  16         17159  
  16         3058  
  16         14280  
  16         3525  
  16         14888  
  16         3130  
  16         21046  
  16         3313  
  16         14076  
  16         60  
  16         3595  
  16         15531  
  16         4545  
  16         16169  
  16         2800  
  16         13891  
  16         64  
  16         3984  
1402             _check_dn(\$_[0], \$_[1]);
1403             _ret_dnn(\$_[0] + \$_[1] + ($ediff) ${z2})
1404             }";
1405             push @EXPORT_OK, "${src}n_to_${dst}nn";
1406 8     8 1 7858 eval "sub ${src}n_to_${dst}nf(\$\$${zp}) {
  8     8 1 1639  
  8     8 1 8989  
  8     8 1 1565  
  8     8 1 7449  
  8     8 1 1565  
  8     8 1 8204  
  8     8 1 1674  
  8     8 1 9105  
  8     8 1 1767  
  8     8 1 8317  
  8     8 1 1711  
  8     8 1 7865  
  8     8 1 1494  
  8     8 1 8241  
  8     8 1 1455  
  8     8 1 9333  
  8     8 1 2445  
  8     8 1 6788  
  8     8 1 1466  
  8     8 1 6772  
  8     8 1 7873  
  8     8 1 10142  
  8     8 1 1659  
  8     8 1 6783  
  8     8 1 1487  
  8     8 1 8305  
  8     8 1 1497  
  8     8 1 9001  
  8     8 1 1501  
  8     8 1 22312  
  8     8 1 1717  
  8     8 1 14883  
  8     8 1 1737  
  8     8 1 8428  
  8     8 1 1448  
  8     8 1 8651  
  8     8 1 1700  
  8     8 1 8326  
  8     8 1 1579  
  8     8 1 8545  
  8     8 1 1568  
  8     8 1 7132  
  8     8 1 1514  
  8     8 1 8204  
  8     8 1 1652  
  8     8 1 10689  
  8     8 1 1639  
  8     8 1 15067  
  8     8 1 1609  
  8     8 1 8897  
  8     8 1 1788  
  8     8 1 8330  
  8     8 1 1649  
  8     8 1 8728  
  8     8 1 1676  
  8     8 1 8730  
  8     8 1 1562  
  8     8 1 7793  
  8     8 1 1541  
  8     8 1 8068  
  8     8 1 1545  
  8     8 1 9089  
  8     8 1 1593  
  8         10550  
  8         1737  
  8         7702  
  8         1375  
  8         8716  
  8         1812  
  8         9044  
  8         1777  
  8         7927  
  8         1573  
  8         8175  
  8         1641  
  8         9237  
  8         1577  
  8         7475  
  8         1603  
  8         7959  
  8         1582  
  8         7696  
  8         1919  
  8         9218  
  8         1625  
  8         8223  
  8         1827  
  8         9368  
  8         1567  
  8         12215  
  8         2326  
  8         12948  
  8         1922  
  8         8186  
  8         1484  
  8         7837  
  8         1520  
  8         8119  
  8         1597  
  8         8506  
  8         1697  
  8         10633  
  8         1626  
  8         8211  
  8         1508  
  8         9085  
  8         1747  
  8         7859  
  8         1590  
  8         9207  
  8         1545  
  8         7284  
  8         1610  
  8         7279  
  8         1503  
  8         7156  
  8         1532  
  8         9250  
  8         1612  
  8         7561  
  8         1459  
  8         18081  
  8         1384  
  8         9146  
  8         2284  
  8         9343  
  8         1835  
1407             _check_dn(\$_[0], \$_[1]);
1408             _ret_dnf(\$_[0] + \$_[1] + ($ediff) ${z2})
1409             }";
1410             push @EXPORT_OK, "${src}n_to_${dst}nf";
1411 16 50   16 1 23473 eval "sub ${src}n_to_${dst}n(\$${tp}\$${zp}) { $tc
  16 50   16 1 68  
  16 50   16 1 3219  
  16 50   16 1 15972  
  16 50   16 1 2716  
  16 50   16 1 15136  
  16 50   16 1 7865  
  16 50   16 1 15266  
  16 50   16 1 60  
  16 50   16 1 3111  
  16 50   16 1 19447  
  16 50   16 1 4070  
  16 50   16 1 17774  
  16 50   16 1 66  
  16 50   16 1 3450  
  16 50   16 1 16920  
  16 50   16 1 3421  
  16 50   16 1 15685  
  16 50   16 1 2785  
  16 50   16 1 21297  
  16 50   16 1 3863  
  16 50   16 1 14000  
  16     16 1 58  
  16     16 1 3901  
  16     16 1 15960  
  16     16 1 69  
  16     16 1 3055  
  16     16 1 22698  
  16     16 1 3143  
  16     16 1 20880  
  16     16 1 3110  
  16     16 1 17108  
  16     16 1 2957  
  16     16 1 16346  
  16     16 1 65  
  16     16 1 3277  
  16     16 1 17191  
  16     16 1 3260  
  16     16 1 22163  
  16     16 1 3045  
  16     16 1 14878  
  16     16 1 58  
  16     16 1 3210  
  16     16 1 16120  
  16     16 1 63  
  16     16 1 3041  
  16     16 1 18286  
  16     16 1 9186  
  16     16 1 15889  
  16     16 1 3216  
  16     16 1 15924  
  16     16 1 3180  
  16     16 1 16936  
  16     16 1 72  
  16     16 1 3697  
  16     16 1 22809  
  16     16 1 3216  
  16     16 1 18772  
  16     16 1 75  
  16     16 1 3413  
  16     16 1 17610  
  16     16 1 3270  
  16     16 1 33287  
  16     16 1 3072  
  16         24291  
  16         69  
  16         2981  
  16         27842  
  16         3315  
  16         15529  
  16         60  
  16         3270  
  16         16691  
  16         3032  
  16         18360  
  16         3371  
  16         45419  
  16         7681  
  16         16596  
  16         2948  
  16         17830  
  16         4166  
  16         19071  
  16         3651  
  16         15839  
  16         64  
  16         3039  
  16         17232  
  16         3202  
  16         17264  
  16         3040  
  16         14922  
  16         63  
  16         3160  
  16         16389  
  16         68  
  16         3383  
  16         18670  
  16         4467  
  16         18460  
  16         2977  
  16         18365  
  16         64  
  16         3082  
  16         16021  
  16         6756  
  16         21835  
  16         67  
  16         9940  
  16         16268  
  16         3375  
  16         17237  
  16         3073  
  16         25029  
  16         3166  
  16         18491  
  16         72  
  16         3191  
  16         24250  
  16         64  
  16         5445  
  16         19997  
  16         3255  
  16         16251  
  16         2902  
  16         18863  
  16         3382  
  16         15025  
  16         57  
  16         8823  
  16         22709  
  16         3733  
  16         16154  
  16         2977  
  16         23519  
  16         2970  
  16         14307  
  16         2914  
  16         19099  
  16         3168  
  16         21212  
  16         66  
  16         4122  
  16         18081  
  16         3048  
  16         15608  
  16         3287  
  16         24950  
  16         66  
  16         3464  
1412             _check_dn(\$_[0], \$_[1]);
1413             _ret_dn(\$_[0] + \$_[1] + ($ediff) ${z2})
1414             }";
1415             push @EXPORT_OK, "${src}n_to_${dst}n";
1416             } }
1417              
1418             =back
1419              
1420             =head1 SEE ALSO
1421              
1422             L,
1423             L,
1424             L,
1425             L
1426              
1427             =head1 AUTHOR
1428              
1429             Andrew Main (Zefram)
1430              
1431             =head1 COPYRIGHT
1432              
1433             Copyright (C) 2006, 2007, 2009, 2010, 2011
1434             Andrew Main (Zefram)
1435              
1436             =head1 LICENSE
1437              
1438             This module is free software; you can redistribute it and/or modify it
1439             under the same terms as Perl itself.
1440              
1441             =cut
1442              
1443             1;