Debian Codegraph @

lib/Date/JD.pm

raw symbols SCIP
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<http://en.wikipedia.org/wiki/Julian_day>.
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<http://cossc.gsfc.nasa.gov/cossc/batse/hilev/TJD.TABLE>.
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<http://www.hermetic.ch/cal_stud/cjd.htm>.
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<http://en.wikipedia.org/wiki/Julian_Date> 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<Time::UTC>
168 for TAI/UTC conversion.)
169
170 =cut
171
172 package Date::JD;
173
174 { use 5.006; }
175 use warnings;
176 use strict;
177
178 use Carp qw(croak);
179
180 our $VERSION = "0.006";
181
182 use parent "Exporter";
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<Math::BigRat>
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<Math::BigRat> is recommended to avoid these problems.
205 With C<Math::BigRat> 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<Math::BigRat> 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 croak "purported day number $_[0] is not an integer"
1338 unless ref($_[0]) ? $_[0]->is_int : $_[0] == int($_[0]);
1339 croak "purported day fraction $_[1] is out of range [0, 1)"
1340 unless $_[1] >= 0 && $_[1] < 1;
1341 }
1342
1343 sub _ret_dnn($) {
1344 my $dn = ref($_[0]) eq "Math::BigRat" ?
1345 $_[0]->copy->bfloor : _floor($_[0]);
1346 return $dn;
1347 }
1348
1349 sub _ret_dnf($) {
1350 my $dn = &_ret_dnn;
1351 return ($dn, $_[0] - $dn);
1352 }
1353
1354 sub _ret_dn($) {
1355 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 eval "sub ${src}_to_${dst}(\$${zp}) { \$_[0] + (${ediff}) ${z1} }";
1374 push @EXPORT_OK, "${src}_to_${dst}";
1375 eval "sub ${src}_to_${dst}nn(\$${zp}) {
1376 _ret_dnn(\$_[0] + (${ediff}) ${z1})
1377 }";
1378 push @EXPORT_OK, "${src}_to_${dst}nn";
1379 eval "sub ${src}_to_${dst}nf(\$${zp}) {
1380 _ret_dnf(\$_[0] + (${ediff}) ${z1})
1381 }";
1382 push @EXPORT_OK, "${src}_to_${dst}nf";
1383 eval "sub ${src}_to_${dst}n(\$${zp}) {
1384 _ret_dn(\$_[0] + (${ediff}) ${z1})
1385 }";
1386 push @EXPORT_OK, "${src}_to_${dst}n";
1387 eval "sub ${src}n_to_${dst}(\$\$${zp}) {
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 eval "sub ${src}n_to_${dst}nn(\$${tp}\$${zp}) { $tc
1400 _check_dn(\$_[0], \$_[1]);
1401 _ret_dnn(\$_[0] + \$_[1] + ($ediff) ${z2})
1402 }";
1403 push @EXPORT_OK, "${src}n_to_${dst}nn";
1404 eval "sub ${src}n_to_${dst}nf(\$\$${zp}) {
1405 _check_dn(\$_[0], \$_[1]);
1406 _ret_dnf(\$_[0] + \$_[1] + ($ediff) ${z2})
1407 }";
1408 push @EXPORT_OK, "${src}n_to_${dst}nf";
1409 eval "sub ${src}n_to_${dst}n(\$${tp}\$${zp}) { $tc
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<Date::ISO8601>,
1421 L<Date::MSD>,
1422 L<DateTime>,
1423 L<Time::UTC>
1424
1425 =head1 AUTHOR
1426
1427 Andrew Main (Zefram) <[email protected]>
1428
1429 =head1 COPYRIGHT
1430
1431 Copyright (C) 2006, 2007, 2009, 2010, 2011, 2017
1432 Andrew Main (Zefram) <[email protected]>
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;