Thanks,
- Charles
> set mtime [file mtime "filename"]
> set last24hr [expr 24 * 60 * 60]
Shouldn't that be:
set last24hr [expr [clock seconds] - {24 * 60 * 60}]
> if {$mtime > $last24hr} {
> puts "file modified before last 24 hrs"
> }
Fredderic
% clock format [clock scan now]
Fri Oct 28 11:33:57 W. Europe Standard Time 2005
% clock format [clock scan yesterday]
Thu Oct 27 11:34:00 W. Europe Standard Time 2005
% clock format [clock scan "24 hours ago"]
Thu Oct 27 11:35:11 W. Europe Standard Time 2005
So you can write:
set last24hr [clock scan yesterday],
or, for possible finer granularity:
set last24hr [clock scan "24 hours ago"]
Thanks agaain,
- Charles
--
David Zolli - Kroc
http://www.kroc.tk
I believe ctime indicates changes to the file's inode. For example,
adding a hard link to a file will change the ctime:
% file stat test.tcl a
% clock format $a(ctime)
Fri Nov 07 14:35:52 EST 2003
% clock format $a(mtime)
Fri Nov 07 14:35:52 EST 2003
% exec sh -c "ln test.tcl foobar"
% file stat test.tcl a
% clock format $a(mtime)
Fri Nov 07 14:35:52 EST 2003
% clock format $a(ctime)
Fri Oct 28 17:16:36 EDT 2005
--
Glenn Jackman
NCF Sysadmin
gle...@ncf.ca
> At 2005-10-28 04:17PM, suchenwi <richard.suchenw...@siemens.com> wrote:
>> And are there cases where ctime isn't mtime? The latter can be had with
>> just [file mtime $filename].
>
> I believe ctime indicates changes to the file's inode. For example,
> adding a hard link to a file will change the ctime:
Yes, ctime tells you the time of physical intervention. When you mess with
the file, ctime gets set. When you mess with contents, mtime is set (and
usually this sets ctime, too, as in-place operations are rare), and when
you just read (and hopefully don't mess it up) atime is set.
So, creation time, modification time and access time.
If that was wrong, I'm more than willing to be corrected, ctime is a bit
of mystery.
--
-Kaitzschu
s="TCL ";while true;do echo -en "\r$s";s=${s:1:${#s}}${s:0:1};sleep .1;done
I dont think they are very reliable. One can change the attribes of
time without touching file (opening or accessing file etc). But for
most part they are fine indicators.
./dinakar
"change time" is more apt than "creation time"
Yes.
> Get fancier with [clock scan]:
> set last24hr [clock scan yesterday],
> or, for possible finer granularity:
> set last24hr [clock scan "24 hours ago"]
Oh, trippy... And about twice as fast, too. :)
Fredderic