Mercurial > octave
changeset 5873:b6ef36e92701
[project @ 2006-06-30 20:46:34 by jwe]
author | jwe |
---|---|
date | Fri, 30 Jun 2006 20:46:34 +0000 |
parents | 44f24cf66b95 |
children | 210c5c98c403 |
files | scripts/ChangeLog scripts/time/datevec.m |
diffstat | 2 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog Fri Jun 30 18:19:42 2006 +0000 +++ b/scripts/ChangeLog Fri Jun 30 20:46:34 2006 +0000 @@ -1,3 +1,8 @@ +2006-06-30 John W. Eaton <jwe@octave.org> + + * time/datevec.m: Make another attempt to account for precision of + datenum format. + 2006-06-29 John W. Eaton <jwe@octave.org> * miscellaneous/dump_prefs.m: Remove obsolete symbols from the list.
--- a/scripts/time/datevec.m Fri Jun 30 18:19:42 2006 +0000 +++ b/scripts/time/datevec.m Fri Jun 30 20:46:34 2006 +0000 @@ -156,11 +156,10 @@ ## datenum format. fracd = date - floor (date); - ## Special case for total days <= 0. - tmpd = abs (365.25*y); - tmpd(tmpd == 0) = 1; - srnd = 10 .^ floor (log10 (tmpd)); - s = round (86400*fracd.*srnd) ./ srnd; + tmps = abs (eps*86400*date); + tmps(tmps == 0) = 1; + srnd = 2 .^ floor (- log2 (tmps)); + s = round (86400 * fracd .* srnd) ./ srnd; h = floor (s / 3600); s = s - 3600 * h; mi = floor (s / 60); @@ -169,7 +168,7 @@ endif if (nargout <= 1) - y = [y m d h mi s]; + y = [y, m, d, h, mi, s]; endif ### endfunction