Re: reply>> my first newbie question

"Adam DePrince, CSA" <[email protected]>
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
Attached is a function that will return a sequence of indices into
os.fstat's return tuple that should be acceptable for use.  Let me know
if this helps, or if I'm just embarrassing myself.

On Wed, 2003-11-19 at 13:14, Jacob Smullyan wrote:
> Hi --
> 
> I believe that ctime is supposed to be change time, not creation time,
> but there is confusion about this; you'll find textbooks that talk
> about it as creation time, and others that talk about how that is a
> misunderstanding.  I'm not sure what POSIX has to say about this, or
> whether that matters, since obviously different platforms deal with it
> differently.
> 
> Perhaps we can add a configure test that checks for this and use mtime
> for platforms that give creation-time semantics for ctime.  I seem to
> recall that there was a reason ctime was preferable to use than mtime,
> but I've forgotten what it was.  Drew, do you remember our discussion
> of this back in 2001?
> 
> js
> 
> 
> On Wed, Nov 19, 2003 at 04:47:53PM +0100, Tomastiq wrote:
> > Hi,
> > 
> > IMHO I've got it.
> > As I see the problem is the ctime handling.
> > In the (cygwin) documentation:
> > "ctime = time of last modification of file status information"
> > In python docs at stat() function:
> > "st_ctime (time of most recent content modification or metadata change)"
> > And skunk uses this ST_CTIME constant for checking the fresh of compiled
> > version of html. But under cygwin this kind of date contains the
> > creation date, so it is not changing. I think this is a win manner
> > and cygwin uses this date. After I changed *_CTIME constants in files
> > to *_MTIME everything is working fine. Hmm. Unfortunately I can't find
> > information about this behaviour at cygwin.com.
> > 
> > thx.toma
> > 
-- 
Adam DePrince, CSA <[email protected]>
testtime.py (text/x-python, 814 B)
#/usr/bin/env python
#
# 


def stat_changed():
    import tempfile
    import os
    import stat
    
    import time


    delay = 2.0
    
    filename = tempfile.mktemp()

    fh = open( filename, "w+" )
    fh.write( "something\n")
    fh.flush()

    start_stat = os.stat( filename )

    start_time = time.time()

    while time.time() < start_time + delay:
        delay = (start_time + 2 ) - time.time()
        if delay > 0 :
            time.sleep( delay )

    fh.write( "else\n" )
    fh.flush()

    end_stat = os.stat( filename )

    retval = []

    for flag in (stat.ST_CTIME, stat.ST_MTIME ):
        if (start_stat[flag] != end_stat[flag] ):
            retval.append( flag )
    fh.close()
    os.unlink( filename )
    return tuple( retval )

print stat_changed()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.