odd timestamps on files when
Charles Steinkuehler
charles at steinkuehler.net
Mon Dec 9 23:55:55 CST 2002
Jonathan Hutchins wrote:
> Has anyone seen anything else? Files from the current year display the time
> instead of the year. Same thing in ash and tcsh, the only other shells I
> have on this system.
AFAIK, this behavior is a "feature" of ls -l (at least it's discussed in
the ls info file):
<quote>
For
files with a time more than six months old or in the future, the
timestamp contains the year instead of the time of day. If the
timestamp contains today's date with the year rather than a time
of day, the file's time is in the future, which means you probably
have clock skew problems which may break programs like `make' that
rely on file times.
</quote>
When I need to parse the file date/time from the shell, I use:
ls --full-time
which outputs consistent fields.
<quote>
`--full-time'
List times in full, rather than using the standard abbreviation
heuristics. The format is currently similar to that of `date',
but this is planned to change in a future release, partly because
modern file time stamps have more precision. It's not possible to
change the format, but you can extract out the date string with
`cut' and then pass the result to `date -d'. *Note `date'
invocation: (sh-utils)date invocation.
This is most useful because the time output includes the seconds.
(Unix filesystems store file timestamps only to the nearest
second, so this option shows all the information there is.) For
example, this can help when you have a Makefile that is not
regenerating files properly.
</quote>
--
Charles Steinkuehler
charles at steinkuehler.net
More information about the Kclug
mailing list