# HG changeset patch # User jwe # Date 1151700394 0 # Node ID b6ef36e92701be49c7ddd8cdf976d69b9a4e6259 # Parent 44f24cf66b959ff961307e0485e56b4dbf5a5e4c [project @ 2006-06-30 20:46:34 by jwe] diff -r 44f24cf66b95 -r b6ef36e92701 scripts/ChangeLog --- 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 + + * time/datevec.m: Make another attempt to account for precision of + datenum format. + 2006-06-29 John W. Eaton * miscellaneous/dump_prefs.m: Remove obsolete symbols from the list. diff -r 44f24cf66b95 -r b6ef36e92701 scripts/time/datevec.m --- 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