File Coverage

blib/lib/Date/JD.pm
Criterion Covered Total %
statement 833 833 100.0
branch 52 98 53.0
condition 1 3 33.3
subroutine 521 521 100.0
pod 512 512 100.0
total 1919 1967 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   81125 { use 5.006; }
  1         5  
175 1     1   7 use warnings;
  1         3  
  1         36  
176 1     1   6 use strict;
  1         6  
  1         41  
177              
178 1     1   7 use Carp qw(croak);
  1         2  
  1         81  
179              
180             our $VERSION = "0.006";
181              
182 1     1   445 use parent "Exporter";
  1         366  
  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   21932 croak "purported day number $_[0] is not an integer"
    50          
1338             unless ref($_[0]) ? $_[0]->is_int : $_[0] == int($_[0]);
1339 3584 50 33     78924 croak "purported day fraction $_[1] is out of range [0, 1)"
1340             unless $_[1] >= 0 && $_[1] < 1;
1341             }
1342              
1343             sub _ret_dnn($) {
1344 5120 100   5120   2064968 my $dn = ref($_[0]) eq "Math::BigRat" ?
1345             $_[0]->copy->bfloor : _floor($_[0]);
1346 5120         181647 return $dn;
1347             }
1348              
1349             sub _ret_dnf($) {
1350 2048     2048   1051809 my $dn = &_ret_dnn;
1351 2048         8898 return ($dn, $_[0] - $dn);
1352             }
1353              
1354             sub _ret_dn($) {
1355 2048 100   2048   2069307 return wantarray ? &_ret_dnf : &_ret_dnn;
1356             }
1357              
1358             foreach my $src (keys %jd_flavours) { foreach my $dst (keys %jd_flavours) {
1359             my $ediff = $jd_flavours{$src}->{epoch_jd} -
1360             $jd_flavours{$dst}->{epoch_jd};
1361             my $ediffh = $ediff == int($ediff) ? 0 : 0.5;
1362             my $src_zone = !!$jd_flavours{$src}->{zone};
1363             my $dst_zone = !!$jd_flavours{$dst}->{zone};
1364             my($zp, $z1, $z2);
1365             if($src_zone == $dst_zone) {
1366             $zp = $z1 = $z2 = "";
1367             } else {
1368             $zp = "\$";
1369             my $zsign = $src_zone ? "-" : "+";
1370             $z1 = "$zsign \$_[1]";
1371             $z2 = "$zsign \$_[2]";
1372             }
1373 16     16 1 33828 eval "sub ${src}_to_${dst}(\$${zp}) { \$_[0] + (${ediff}) ${z1} }";
  16     16 1 31458  
  16     16 1 34595  
  16     16 1 26200  
  16     16 1 40802  
  16     16 1 34822  
  16     16 1 42616  
  16     16 1 33985  
  16     16 1 30614  
  16     16 1 26129  
  16     16 1 28537  
  16     16 1 31196  
  16     16 1 29499  
  16     16 1 31524  
  16     16 1 26963  
  16     16 1 34939  
  16     16 1 44626  
  16     16 1 29830  
  16     16 1 34887  
  16     16 1 35817  
  16     16 1 26040  
  16     16 1 38347  
  16     16 1 26416  
  16     16 1 35339  
  16     16 1 31391  
  16     16 1 37005  
  16     16 1 44190  
  16     16 1 30141  
  16     16 1 34616  
  16     16 1 35903  
  16     16 1 40501  
  16     16 1 42408  
  16     16 1 34321  
  16     16 1 32459  
  16     16 1 29249  
  16     16 1 30004  
  16     16 1 112360  
  16     16 1 38910  
  16     16 1 30875  
  16     16 1 31910  
  16     16 1 24426  
  16     16 1 34972  
  16     16 1 37398  
  16     16 1 34780  
  16     16 1 29287  
  16     16 1 32127  
  16     16 1 34550  
  16     16 1 38243  
  16     16 1 36733  
  16     16 1 30172  
  16     16 1 22989  
  16     16 1 35538  
  16     16 1 29757  
  16     16 1 35289  
  16     16 1 26378  
  16     16 1 32876  
  16     16 1 32281  
  16     16 1 28936  
  16     16 1 32259  
  16     16 1 44449  
  16     16 1 32227  
  16     16 1 40982  
  16     16 1 31614  
  16     16 1 36286  
1374             push @EXPORT_OK, "${src}_to_${dst}";
1375 16     16 1 14527 eval "sub ${src}_to_${dst}nn(\$${zp}) {
  16     16 1 16301  
  16     16 1 16618  
  16     16 1 11178  
  16     16 1 22466  
  16     16 1 13202  
  16     16 1 20900  
  16     16 1 17517  
  16     16 1 16389  
  16     16 1 12476  
  16     16 1 11481  
  16     16 1 15928  
  16     16 1 12541  
  16     16 1 16356  
  16     16 1 10543  
  16     16 1 15076  
  16     16 1 22124  
  16     16 1 13452  
  16     16 1 12978  
  16     16 1 19096  
  16     16 1 11730  
  16     16 1 19276  
  16     16 1 10647  
  16     16 1 15024  
  16     16 1 12244  
  16     16 1 20638  
  16     16 1 20087  
  16     16 1 11818  
  16     16 1 17474  
  16     16 1 14969  
  16     16 1 20621  
  16     16 1 20093  
  16     16 1 15862  
  16     16 1 15340  
  16     16 1 12302  
  16     16 1 17689  
  16     16 1 13760  
  16     16 1 17812  
  16     16 1 13240  
  16     16 1 13025  
  16     16 1 9860  
  16     16 1 16725  
  16     16 1 19006  
  16     16 1 14270  
  16     16 1 14734  
  16     16 1 12958  
  16     16 1 17909  
  16     16 1 19631  
  16     16 1 23017  
  16     16 1 13593  
  16     16 1 9822  
  16     16 1 20191  
  16     16 1 13480  
  16     16 1 19023  
  16     16 1 10116  
  16     16 1 14879  
  16     16 1 17616  
  16     16 1 12765  
  16     16 1 13882  
  16     16 1 20189  
  16     16 1 13735  
  16     16 1 20800  
  16     16 1 14262  
  16     16 1 14677  
1376             _ret_dnn(\$_[0] + (${ediff}) ${z1})
1377             }";
1378             push @EXPORT_OK, "${src}_to_${dst}nn";
1379 8     8 1 8962 eval "sub ${src}_to_${dst}nf(\$${zp}) {
  8     8 1 7706  
  8     8 1 8464  
  8     8 1 8307  
  8     8 1 10230  
  8     8 1 8685  
  8     8 1 9189  
  8     8 1 7184  
  8     8 1 6754  
  8     8 1 7750  
  8     8 1 7118  
  8     8 1 7834  
  8     8 1 7505  
  8     8 1 6755  
  8     8 1 7066  
  8     8 1 7969  
  8     8 1 9142  
  8     8 1 8182  
  8     8 1 8048  
  8     8 1 7407  
  8     8 1 6711  
  8     8 1 7427  
  8     8 1 6665  
  8     8 1 8395  
  8     8 1 7748  
  8     8 1 9662  
  8     8 1 8644  
  8     8 1 7508  
  8     8 1 8153  
  8     8 1 9193  
  8     8 1 10540  
  8     8 1 9921  
  8     8 1 8749  
  8     8 1 8826  
  8     8 1 7202  
  8     8 1 7910  
  8     8 1 7864  
  8     8 1 8554  
  8     8 1 7984  
  8     8 1 8125  
  8     8 1 6534  
  8     8 1 7965  
  8     8 1 8806  
  8     8 1 8392  
  8     8 1 6998  
  8     8 1 8862  
  8     8 1 8321  
  8     8 1 8712  
  8     8 1 8842  
  8     8 1 8761  
  8     8 1 6519  
  8     8 1 8630  
  8     8 1 8163  
  8     8 1 8020  
  8     8 1 6661  
  8     8 1 8206  
  8     8 1 7423  
  8     8 1 7413  
  8     8 1 9264  
  8     8 1 7868  
  8     8 1 7942  
  8     8 1 9348  
  8     8 1 8028  
  8     8 1 9156  
1380             _ret_dnf(\$_[0] + (${ediff}) ${z1})
1381             }";
1382             push @EXPORT_OK, "${src}_to_${dst}nf";
1383 16     16 1 31178 eval "sub ${src}_to_${dst}n(\$${zp}) {
  16     16 1 24419  
  16     16 1 26386  
  16     16 1 26070  
  16     16 1 30972  
  16     16 1 25577  
  16     16 1 24997  
  16     16 1 24892  
  16     16 1 20998  
  16     16 1 24352  
  16     16 1 25878  
  16     16 1 22325  
  16     16 1 24177  
  16     16 1 20736  
  16     16 1 20606  
  16     16 1 26866  
  16     16 1 28952  
  16     16 1 26426  
  16     16 1 24616  
  16     16 1 26703  
  16     16 1 26781  
  16     16 1 23058  
  16     16 1 21605  
  16     16 1 27322  
  16     16 1 27438  
  16     16 1 28062  
  16     16 1 27381  
  16     16 1 23232  
  16     16 1 24462  
  16     16 1 29696  
  16     16 1 28477  
  16     16 1 29793  
  16     16 1 27677  
  16     16 1 25759  
  16     16 1 24431  
  16     16 1 25969  
  16     16 1 27958  
  16     16 1 25203  
  16     16 1 24175  
  16     16 1 27195  
  16     16 1 22174  
  16     16 1 24171  
  16     16 1 29716  
  16     16 1 26326  
  16     16 1 23532  
  16     16 1 26998  
  16     16 1 22774  
  16     16 1 28572  
  16     16 1 27945  
  16     16 1 29768  
  16     16 1 22536  
  16     16 1 21269  
  16     16 1 23088  
  16     16 1 26495  
  16     16 1 23654  
  16     16 1 28289  
  16     16 1 22785  
  16     16 1 24116  
  16     16 1 24503  
  16     16 1 24737  
  16     16 1 28678  
  16     16 1 23671  
  16     16 1 28186  
  16     16 1 27564  
1384             _ret_dn(\$_[0] + (${ediff}) ${z1})
1385             }";
1386             push @EXPORT_OK, "${src}_to_${dst}n";
1387 16     16 1 24884 eval "sub ${src}n_to_${dst}(\$\$${zp}) {
  16     16 1 13892  
  16     16 1 25952  
  16     16 1 12105  
  16     16 1 32588  
  16     16 1 15506  
  16     16 1 23225  
  16     16 1 15588  
  16     16 1 31913  
  16     16 1 16086  
  16     16 1 22522  
  16     16 1 14108  
  16     16 1 33678  
  16     16 1 15511  
  16     16 1 29079  
  16     16 1 15930  
  16     16 1 24067  
  16     16 1 11622  
  16     16 1 20532  
  16     16 1 13661  
  16     16 1 21567  
  16     16 1 13968  
  16     16 1 24990  
  16     16 1 11255  
  16     16 1 24656  
  16     16 1 15323  
  16     16 1 23654  
  16     16 1 11951  
  16     16 1 21739  
  16     16 1 14943  
  16     16 1 19996  
  16     16 1 10477  
  16     16 1 26642  
  16     16 1 12405  
  16     16 1 20954  
  16     16 1 12987  
  16     16 1 21706  
  16     16 1 13008  
  16     16 1 28021  
  16     16 1 12829  
  16     16 1 25560  
  16     16 1 15847  
  16     16 1 24661  
  16     16 1 11031  
  16     16 1 17824  
  16     16 1 10886  
  16     16 1 25148  
  16     16 1 14772  
  16     16 1 24632  
  16     16 1 16820  
  16     16 1 36429  
  16     16 1 18235  
  16     16 1 29615  
  16     16 1 13108  
  16     16 1 21287  
  16     16 1 14068  
  16     16 1 28665  
  16     16 1 14474  
  16     16 1 24419  
  16     16 1 15229  
  16     16 1 38584  
  16     16 1 19711  
  16     16 1 33847  
  16     16 1 16245  
  16         33097  
  16         17283  
  16         24469  
  16         14971  
  16         31819  
  16         13421  
  16         28376  
  16         14903  
  16         23411  
  16         15107  
  16         28946  
  16         14546  
  16         22445  
  16         14111  
  16         23105  
  16         12469  
  16         19140  
  16         10771  
  16         27313  
  16         12962  
  16         30913  
  16         14544  
  16         24122  
  16         13825  
  16         24041  
  16         11970  
  16         26339  
  16         16211  
  16         27400  
  16         12628  
  16         28748  
  16         13487  
  16         27292  
  16         13678  
  16         24885  
  16         15759  
  16         17248  
  16         11519  
  16         23583  
  16         12290  
  16         23516  
  16         13836  
  16         23979  
  16         11033  
  16         22688  
  16         14308  
  16         25560  
  16         16126  
  16         24807  
  16         12433  
  16         22714  
  16         13718  
  16         22549  
  16         12887  
  16         26926  
  16         12226  
  16         25746  
  16         16897  
  16         29511  
  16         14685  
  16         29253  
  16         16981  
  16         21888  
  16         12993  
1388             _check_dn(\$_[0], \$_[1]);
1389             \$_[0] + \$_[1] + (${ediff}) ${z2}
1390             }";
1391             push @EXPORT_OK, "${src}n_to_${dst}";
1392             my($tp, $tc);
1393             if($ediffh == 0 && $src_zone == $dst_zone) {
1394             $tp = ";";
1395             $tc = "push \@_, 0 if \@_ == 1;";
1396             } else {
1397             $tp = $tc = "";
1398             }
1399 16 50   16 1 18272 eval "sub ${src}n_to_${dst}nn(\$${tp}\$${zp}) { $tc
  16 50   16 1 84  
  16 50   16 1 14189  
  16 50   16 1 22996  
  16 50   16 1 14373  
  16 50   16 1 23708  
  16 50   16 1 12805  
  16 50   16 1 18177  
  16 50   16 1 75  
  16 50   16 1 16043  
  16 50   16 1 26032  
  16 50   16 1 17299  
  16 50   16 1 19454  
  16 50   16 1 86  
  16 50   16 1 16061  
  16 50   16 1 28896  
  16 50   16 1 15841  
  16 50   16 1 23508  
  16 50   16 1 15295  
  16 50   16 1 20880  
  16 50   16 1 12539  
  16 50   16 1 15469  
  16     16 1 72  
  16     16 1 11976  
  16     16 1 16666  
  16     16 1 69  
  16     16 1 13056  
  16     16 1 20104  
  16     16 1 11030  
  16     16 1 20365  
  16     16 1 17168  
  16     16 1 19932  
  16     16 1 10724  
  16     16 1 13094  
  16     16 1 69  
  16     16 1 10887  
  16     16 1 14799  
  16     16 1 10979  
  16     16 1 20264  
  16     16 1 11356  
  16     16 1 14057  
  16     16 1 109  
  16     16 1 12498  
  16     16 1 17131  
  16     16 1 79  
  16     16 1 12507  
  16     16 1 22302  
  16     16 1 12814  
  16     16 1 20204  
  16     16 1 16703  
  16     16 1 18874  
  16     16 1 10848  
  16     16 1 13795  
  16     16 1 69  
  16     16 1 11257  
  16     16 1 19026  
  16     16 1 13610  
  16     16 1 19512  
  16     16 1 92  
  16     16 1 16837  
  16     16 1 27056  
  16     16 1 16812  
  16     16 1 22603  
  16     16 1 13159  
  16         16582  
  16         72  
  16         12360  
  16         21545  
  16         13837  
  16         18283  
  16         92  
  16         13671  
  16         33844  
  16         21340  
  16         28344  
  16         18464  
  16         22668  
  16         14324  
  16         19937  
  16         15330  
  16         16621  
  16         13444  
  16         22534  
  16         14217  
  16         17642  
  16         82  
  16         15210  
  16         23901  
  16         15220  
  16         17644  
  16         14348  
  16         15166  
  16         71  
  16         11726  
  16         13487  
  16         68  
  16         11009  
  16         22873  
  16         13178  
  16         23822  
  16         13516  
  16         17472  
  16         81  
  16         12908  
  16         19610  
  16         12010  
  16         19300  
  16         146  
  16         13015  
  16         22210  
  16         13281  
  16         21879  
  16         13822  
  16         24457  
  16         16968  
  16         18303  
  16         90  
  16         13210  
  16         13932  
  16         72  
  16         11430  
  16         21169  
  16         11556  
  16         17172  
  16         14638  
  16         19928  
  16         10602  
  16         16835  
  16         86  
  16         13202  
  16         17552  
  16         12176  
  16         19272  
  16         13399  
  16         17519  
  16         14076  
  16         16761  
  16         12753  
  16         21452  
  16         14029  
  16         19442  
  16         81  
  16         16327  
  16         25658  
  16         15003  
  16         20986  
  16         14424  
  16         16207  
  16         73  
  16         12672  
1400             _check_dn(\$_[0], \$_[1]);
1401             _ret_dnn(\$_[0] + \$_[1] + ($ediff) ${z2})
1402             }";
1403             push @EXPORT_OK, "${src}n_to_${dst}nn";
1404 8     8 1 9481 eval "sub ${src}n_to_${dst}nf(\$\$${zp}) {
  8     8 1 8475  
  8     8 1 8670  
  8     8 1 7613  
  8     8 1 7149  
  8     8 1 5618  
  8     8 1 8714  
  8     8 1 8361  
  8     8 1 9001  
  8     8 1 7433  
  8     8 1 8901  
  8     8 1 8247  
  8     8 1 9647  
  8     8 1 7190  
  8     8 1 7697  
  8     8 1 7425  
  8     8 1 7437  
  8     8 1 6614  
  8     8 1 6923  
  8     8 1 5645  
  8     8 1 8971  
  8     8 1 7559  
  8     8 1 7312  
  8     8 1 5613  
  8     8 1 8701  
  8     8 1 7761  
  8     8 1 6987  
  8     8 1 6374  
  8     8 1 6385  
  8     8 1 5697  
  8     8 1 7474  
  8     8 1 5531  
  8     8 1 8517  
  8     8 1 6234  
  8     8 1 8228  
  8     8 1 6690  
  8     8 1 8847  
  8     8 1 5834  
  8     8 1 8327  
  8     8 1 7908  
  8     8 1 8618  
  8     8 1 8337  
  8     8 1 7639  
  8     8 1 6407  
  8     8 1 6997  
  8     8 1 5917  
  8     8 1 8374  
  8     8 1 7358  
  8     8 1 9169  
  8     8 1 9439  
  8     8 1 9526  
  8     8 1 8985  
  8     8 1 9451  
  8     8 1 7305  
  8     8 1 7698  
  8     8 1 6319  
  8     8 1 8544  
  8     8 1 7704  
  8     8 1 8478  
  8     8 1 6830  
  8     8 1 9730  
  8     8 1 9288  
  8     8 1 10343  
  8     8 1 8215  
  8         7782  
  8         7058  
  8         8425  
  8         7426  
  8         7264  
  8         6529  
  8         7722  
  8         7758  
  8         8300  
  8         7581  
  8         8412  
  8         8768  
  8         7626  
  8         6777  
  8         7525  
  8         6379  
  8         6631  
  8         5709  
  8         7384  
  8         5799  
  8         7845  
  8         6521  
  8         8863  
  8         7443  
  8         6983  
  8         5726  
  8         8859  
  8         6114  
  8         7901  
  8         6513  
  8         7878  
  8         6781  
  8         9877  
  8         9243  
  8         8328  
  8         6272  
  8         6761  
  8         5872  
  8         7133  
  8         5635  
  8         7899  
  8         6810  
  8         7011  
  8         5228  
  8         7868  
  8         6486  
  8         8087  
  8         6590  
  8         7596  
  8         7308  
  8         8135  
  8         8243  
  8         7671  
  8         6235  
  8         9620  
  8         7485  
  8         8498  
  8         7828  
  8         8982  
  8         7418  
  8         8476  
  8         6564  
  8         8867  
  8         6493  
1405             _check_dn(\$_[0], \$_[1]);
1406             _ret_dnf(\$_[0] + \$_[1] + ($ediff) ${z2})
1407             }";
1408             push @EXPORT_OK, "${src}n_to_${dst}nf";
1409 16 50   16 1 18429 eval "sub ${src}n_to_${dst}n(\$${tp}\$${zp}) { $tc
  16 50   16 1 83  
  16 50   16 1 16468  
  16 50   16 1 16220  
  16 50   16 1 15346  
  16 50   16 1 13495  
  16 50   16 1 12848  
  16 50   16 1 16002  
  16 50   16 1 81  
  16 50   16 1 16881  
  16 50   16 1 15834  
  16 50   16 1 12798  
  16 50   16 1 16943  
  16 50   16 1 81  
  16 50   16 1 14136  
  16 50   16 1 16719  
  16 50   16 1 13262  
  16 50   16 1 16409  
  16 50   16 1 15415  
  16 50   16 1 13981  
  16 50   16 1 13234  
  16 50   16 1 12039  
  16     16 1 64  
  16     16 1 10904  
  16     16 1 16356  
  16     16 1 87  
  16     16 1 14154  
  16     16 1 13572  
  16     16 1 11444  
  16     16 1 15813  
  16     16 1 14454  
  16     16 1 13241  
  16     16 1 11523  
  16     16 1 12204  
  16     16 1 68  
  16     16 1 10979  
  16     16 1 13653  
  16     16 1 10766  
  16     16 1 16983  
  16     16 1 14406  
  16     16 1 15490  
  16     16 1 79  
  16     16 1 14492  
  16     16 1 16955  
  16     16 1 85  
  16     16 1 11200  
  16     16 1 13690  
  16     16 1 11729  
  16     16 1 20403  
  16     16 1 20397  
  16     16 1 13787  
  16     16 1 11626  
  16     16 1 14191  
  16     16 1 74  
  16     16 1 13206  
  16     16 1 16432  
  16     16 1 15446  
  16     16 1 18968  
  16     16 1 133  
  16     16 1 17377  
  16     16 1 17263  
  16     16 1 17045  
  16     16 1 16808  
  16     16 1 14486  
  16         13602  
  16         78  
  16         11512  
  16         16320  
  16         17261  
  16         17152  
  16         87  
  16         15060  
  16         18378  
  16         17271  
  16         18220  
  16         16139  
  16         16103  
  16         16717  
  16         15600  
  16         14347  
  16         14765  
  16         13077  
  16         14115  
  16         13200  
  16         17302  
  16         79  
  16         14599  
  16         15741  
  16         14370  
  16         14151  
  16         14827  
  16         14187  
  16         70  
  16         12449  
  16         12941  
  16         86  
  16         11472  
  16         14093  
  16         11490  
  16         19896  
  16         18526  
  16         16416  
  16         83  
  16         14555  
  16         12703  
  16         12925  
  16         15215  
  16         78  
  16         13125  
  16         15259  
  16         15485  
  16         15999  
  16         13664  
  16         18054  
  16         15999  
  16         14305  
  16         72  
  16         12573  
  16         14336  
  16         72  
  16         14852  
  16         12670  
  16         11089  
  16         15122  
  16         16859  
  16         13390  
  16         10615  
  16         15194  
  16         78  
  16         13877  
  16         15164  
  16         14256  
  16         15977  
  16         14486  
  16         14960  
  16         14796  
  16         14433  
  16         12293  
  16         17083  
  16         14749  
  16         17346  
  16         74  
  16         16916  
  16         17685  
  16         14483  
  16         14626  
  16         12301  
  16         16207  
  16         78  
  16         13342  
1410             _check_dn(\$_[0], \$_[1]);
1411             _ret_dn(\$_[0] + \$_[1] + ($ediff) ${z2})
1412             }";
1413             push @EXPORT_OK, "${src}n_to_${dst}n";
1414             } }
1415              
1416             =back
1417              
1418             =head1 SEE ALSO
1419              
1420             L,
1421             L,
1422             L,
1423             L
1424              
1425             =head1 AUTHOR
1426              
1427             Andrew Main (Zefram)
1428              
1429             =head1 COPYRIGHT
1430              
1431             Copyright (C) 2006, 2007, 2009, 2010, 2011, 2017
1432             Andrew Main (Zefram)
1433              
1434             =head1 LICENSE
1435              
1436             This module is free software; you can redistribute it and/or modify it
1437             under the same terms as Perl itself.
1438              
1439             =cut
1440              
1441             1;