Mercurial > hg > octave-nkf
comparison scripts/time/datenum.m @ 20072:e9f89866074c
maint: Cleanup some .m files to follow Octave coding conventions.
* accumarray.m, validateattributes.m, iscolormap.m, __imread__.m,
__imwrite__.m, imwrite_filename.m, strread.m, getappdata.m,
appearance/annotation.m, shrinkfaces.m, rundemos.m, runtests.m,
datenum.m, datestr.m: Break long lines before && and ||.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 26 Feb 2015 13:13:40 -0500 |
parents | 9fc020886ae9 |
children | 2645f9ef8c88 |
comparison
equal
deleted
inserted
replaced
20071:17d647821d61 | 20072:e9f89866074c |
---|---|
94 | 94 |
95 ## Days until start of month assuming year starts March 1. | 95 ## Days until start of month assuming year starts March 1. |
96 persistent monthstart = [306; 337; 0; 31; 61; 92; 122; 153; 184; 214; 245; 275]; | 96 persistent monthstart = [306; 337; 0; 31; 61; 92; 122; 153; 184; 214; 245; 275]; |
97 persistent monthlength = [31; 28; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31]; | 97 persistent monthlength = [31; 28; 31; 30; 31; 30; 31; 31; 30; 31; 30; 31]; |
98 | 98 |
99 if (nargin == 0 || nargin > 6 || | 99 if (nargin == 0 || nargin > 6 |
100 (nargin > 2 && (ischar (year) || iscellstr (year)))) | 100 || (nargin > 2 && (ischar (year) || iscellstr (year)))) |
101 print_usage (); | 101 print_usage (); |
102 endif | 102 endif |
103 | 103 |
104 if (ischar (year) || iscellstr (year)) | 104 if (ischar (year) || iscellstr (year)) |
105 [year, month, day, hour, minute, second] = datevec (year, month); | 105 [year, month, day, hour, minute, second] = datevec (year, month); |
128 | 128 |
129 ## Treat fractional months, by converting the fraction to days | 129 ## Treat fractional months, by converting the fraction to days |
130 if (floor (month) != month) | 130 if (floor (month) != month) |
131 fracmonth = month - floor (month); | 131 fracmonth = month - floor (month); |
132 month = floor (month); | 132 month = floor (month); |
133 if ((mod (month-1,12) + 1) == 2 && | 133 if ((mod (month-1,12) + 1) == 2 |
134 (floor (year/4) - floor (year/100) + floor (year/400)) != 0) | 134 && (floor (year/4) - floor (year/100) + floor (year/400)) != 0) |
135 ## leap year | 135 ## leap year |
136 day += fracmonth * 29; | 136 day += fracmonth * 29; |
137 else | 137 else |
138 day += fracmonth * monthlength ((mod (month-1,12) + 1)); | 138 day += fracmonth * monthlength ((mod (month-1,12) + 1)); |
139 endif | 139 endif |