Mercurial > hg > octave-terminal
changeset 6947:4b41514e5ef0
[project @ 2007-10-03 14:47:32 by jwe]
author | jwe |
---|---|
date | Wed, 03 Oct 2007 14:47:32 +0000 |
parents | 10c7a803b409 |
children | 755222bd2dbf |
files | scripts/ChangeLog scripts/miscellaneous/dir.m |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2007-10-03 John W. Eaton <jwe@octave.org> + + * miscellaneous/dir.m: Create empty struct with field names. + Include datenum in struct. + 2007-10-02 David Bateman <dbateman@free.fr> * miscellaneous/ls.m: If nargout return string array of files
--- a/scripts/miscellaneous/dir.m +++ b/scripts/miscellaneous/dir.m @@ -59,7 +59,8 @@ endif ## Prep the retval. - info = struct (zeros (0, 1)); + info = struct (zeros (0, 1), + {"name", "date", "bytes", "isdir", "datenum", "statinfo"}); if (ischar (file)) if (strcmp (file, "*")) @@ -101,9 +102,12 @@ [dummy, fn, ext] = fileparts (fn); fn = strcat (fn, ext); info(i,1).name = fn; - info(i,1).date = strftime ("%d-%b-%Y %T", localtime (st.mtime)); + lt = localtime (st.mtime) + info(i,1).date = strftime ("%d-%b-%Y %T", lt); info(i,1).bytes = st.size; info(i,1).isdir = st.modestr(1) == "d"; + info(i,1).datenum = datenum (lt.year + 1900, lt.mon, lt.mday, + lt.hour, lt.min, lt.sec); info(i,1).statinfo = st; endif endfor