This is a static copy of a profile reportHome
jd2date (123 calls, 0.022 sec)
Generated 05-Aug-2011 13:00:35 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/dateconv/jd2date.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
47 | [hour, minute, second] = days2... | 122 | 0.011 s | 50.0% |  |
62 | year = b * 100 + d - 4800 + f... | 123 | 0 s | 0% |  |
61 | month = m + 3 - 12 * floor(m /... | 123 | 0 s | 0% |  |
60 | day = e - floor((153 * m + 2... | 123 | 0 s | 0% |  |
58 | m = floor((5 * e + 2) / 153); | 123 | 0 s | 0% |  |
All other lines | | | 0.011 s | 50.0% |  |
Totals | | | 0.022 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
days2hms | function | 122 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.022 s | 100.0% |  |
Totals | | | 0.022 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 62 |
Non-code lines (comments, blank lines) | 46 |
Code lines (lines that can run) | 16 |
Code lines that did run | 16 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
1 function [year, month, day, hour, minute, second] = jd2date(jd)
2 %JD2DATE Gregorian calendar date from modified Julian day number.
3 %
4 % [YEAR, MONTH, DAY, HOUR, MINUTE, SECOND] = JD2DATE(JD) returns the
5 % Gregorian calendar date (year, month, day, hour, minute, and second)
6 % corresponding to the Julian day number JD.
7 %
8 % Start of the JD (Julian day) count is from 0 at 12 noon 1 JAN -4712
9 % (4713 BC), Julian proleptic calendar. Note that this day count conforms
10 % with the astronomical convention starting the day at noon, in contrast
11 % with the civil practice where the day starts with midnight.
12 %
13 % Astronomers have used the Julian period to assign a unique number to
14 % every day since 1 January 4713 BC. This is the so-called Julian Day
15 % (JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
16 % (Julian calendar) to noon UTC on 2 January 4713 BC.
17
18 % Sources: - http://tycho.usno.navy.mil/mjd.html
19 % - The Calendar FAQ (http://www.faqs.org)
20
21 % Author: Peter J. Acklam
22 % Time-stamp: 2002-05-24 15:24:45 +0200
23 % E-mail: pjacklam@online.no
24 % URL: http://home.online.no/~pjacklam
25
123 26 nargsin = nargin;
123 27 error(nargchk(1, 1, nargsin));
28
29 % Adding 0.5 to JD and taking FLOOR ensures that the date is correct.
30 % Here are some sample values:
31 %
32 % MJD Date Time
33 % -1.00 = 1858-11-16 00:00 (not 1858-11-15 24:00!)
34 % -0.75 = 1858-11-16 06:00
35 % -0.50 = 1858-11-16 12:00
36 % -0.25 = 1858-11-16 18:00
37 % 0.00 = 1858-11-17 00:00 (not 1858-11-16 24:00!)
38 % +0.25 = 1858-11-17 06:00
39 % +0.50 = 1858-11-17 12:00
40 % +0.75 = 1858-11-17 18:00
41 % +1.00 = 1858-11-18 00:00 (not 1858-11-17 24:00!)
42
123 43 ijd = floor(jd + 0.5); % integer part
44
123 45 if nargout > 3
122 46 fjd = jd - ijd + 0.5; % fraction part
0.01 122 47 [hour, minute, second] = days2hms(fjd);
122 48 end
49
50 % The following algorithm is from the Calendar FAQ.
51
123 52 a = ijd + 32044;
123 53 b = floor((4 * a + 3) / 146097);
123 54 c = a - floor((b * 146097) / 4);
55
123 56 d = floor((4 * c + 3) / 1461);
123 57 e = c - floor((1461 * d) / 4);
123 58 m = floor((5 * e + 2) / 153);
59
123 60 day = e - floor((153 * m + 2) / 5) + 1;
123 61 month = m + 3 - 12 * floor(m / 10);
123 62 year = b * 100 + d - 4800 + floor(m / 10);