This is a static copy of a profile reportHome
date2jd (13 calls, 0.000 sec)
Generated 05-Aug-2011 13:00:33 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/dateconv/date2jd.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
date2mjd | function | 13 |
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
51 | + ( second + 60*minute + 3600*... | 13 | 0 s | 0% |  |
49 | jd = day + floor((153*m + 2)/5... | 13 | 0 s | 0% |  |
46 | m = month + 12*a - 3; | 13 | 0 s | 0% |  |
45 | y = year + 4800 - a; | 13 | 0 s | 0% |  |
44 | a = floor((14 - month)/12); | 13 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0 s | 0% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
deal | function | 13 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0 s | 0% |  |
Totals | | | 0 s | 0% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 51 |
Non-code lines (comments, blank lines) | 37 |
Code lines (lines that can run) | 14 |
Code lines that did run | 11 |
Code lines that did not run | 3 |
Coverage (did run/can run) | 78.57 % |
Function listing
time calls line
1 function jd = date2jd(varargin)
2 %DATE2JD Julian day number from Gregorian date.
3 %
4 % JD = DATE2JD(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) returns the Julian
5 % day number of the given date (Gregorian calendar) plus a fractional part
6 % depending on the time of day.
7 %
8 % Any missing MONTH or DAY will be replaced by ones. Any missing HOUR,
9 % MINUTE or SECOND will be replaced by zeros.
10 %
11 % If no date is specified, the current date and time is used.
12 %
13 % Start of the JD (Julian day) count is from 0 at 12 noon 1 January -4712
14 % (4713 BC), Julian proleptic calendar. Note that this day count conforms
15 % with the astronomical convention starting the day at noon, in contrast
16 % with the civil practice where the day starts with midnight.
17 %
18 % Astronomers have used the Julian period to assign a unique number to
19 % every day since 1 January 4713 BC. This is the so-called Julian Day
20 % (JD). JD 0 designates the 24 hours from noon UTC on 1 January 4713 BC
21 % (Julian proleptic calendar) to noon UTC on 2 January 4713 BC.
22
23 % Sources: - http://tycho.usno.navy.mil/mjd.html
24 % - The Calendar FAQ (http://www.faqs.org)
25
26 % Author: Peter J. Acklam
27 % Time-stamp: 2002-05-24 13:30:06 +0200
28 % E-mail: pjacklam@online.no
29 % URL: http://home.online.no/~pjacklam
30
13 31 nargsin = nargin;
13 32 error(nargchk(0, 6, nargsin));
13 33 if nargsin
13 34 argv = {1 1 1 0 0 0};
13 35 argv(1:nargsin) = varargin;
36 else
37 argv = num2cell(clock);
38 end
13 39 [year, month, day, hour, minute, second] = deal(argv{:});
40
41 % The following algorithm is a modified version of the one found in the
42 % Calendar FAQ.
43
13 44 a = floor((14 - month)/12);
13 45 y = year + 4800 - a;
13 46 m = month + 12*a - 3;
47
48 % For a date in the Gregorian calendar:
13 49 jd = day + floor((153*m + 2)/5) ...
50 + y*365 + floor(y/4) - floor(y/100) + floor(y/400) - 32045 ...
13 51 + ( second + 60*minute + 3600*(hour - 12) )/86400;