Mercurial > octave-antonio
diff scripts/time/datevec.m @ 5859:ba0bea22167b
[project @ 2006-06-14 18:18:51 by jwe]
author | jwe |
---|---|
date | Wed, 14 Jun 2006 18:18:51 +0000 |
parents | a2902024bc4e |
children | b645066d40ad |
line wrap: on
line diff
--- a/scripts/time/datevec.m Tue Jun 13 18:55:53 2006 +0000 +++ b/scripts/time/datevec.m Wed Jun 14 18:18:51 2006 +0000 @@ -152,8 +152,12 @@ ++y(m > 12); m(m > 12) -= 12; - ## Convert hour-minute-seconds - s = 86400 * (date - floor (date)); + ## Convert hour-minute-seconds. Attempt to account for precision of + ## datenum format. + + fracd = date - floor (date); + srnd = 10 .^ floor (log10 (365.25*y)); + s = round (86400*fracd.*srnd) ./ srnd; h = floor (s / 3600); s = s - 3600 * h; mi = floor (s / 60);