Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change' and 'modification'.

1,693 views
Skip to first unread message

陈伟

unread,
Sep 28, 2012, 9:12:35 AM9/28/12
to

Chris Angelico

unread,
Sep 28, 2012, 11:07:15 AM9/28/12
to pytho...@python.org
On Fri, Sep 28, 2012 at 11:12 PM, 陈伟 <chenwei...@gmail.com> wrote:
>
> --
> http://mail.python.org/mailman/listinfo/python-list

In future, can you put the body of your message into the body please? :)

ctime is creation time, not change time. mtime is modification time,
as you have. But I can understand where the confusion comes from;
Google tells me there've been documentation bugs involving this very
thing (and Google, being extremely Lawful Neutral, would have happily
told you the same thing if you'd asked).

ChrisA

Christian Heimes

unread,
Sep 28, 2012, 11:18:28 AM9/28/12
to pytho...@python.org
In the future please read the manual before replying! ;) You are wrong,
ctime is *not* the creation time. It's the change time of the inode.
It's updated whenever the inode is modified, e.g. metadata modifications
like permission changes, link/unlink of hard links etc.

Christian






Chris Angelico

unread,
Sep 28, 2012, 11:25:18 AM9/28/12
to pytho...@python.org
Whoops, my bad! Sorry. I was remembering some other APIs with similar
terminology.

Lesson: Check the docs, they're more reliable.

ChrisA

Nobody

unread,
Sep 28, 2012, 1:22:11 PM9/28/12
to
On Fri, 28 Sep 2012 06:12:35 -0700, 陈伟 wrote:

> what is the difference between st_ctime and st_mtime one is the time of
> last change and the other is the time of last modification, but i can
> not understand what is the difference between 'change' and 'modification'.

st_mtime is updated when the file's contents change. st_ctime is updated
when the file's metadata (owner, group, permissions, link count, etc)
changes.

Kristen J. Webb

unread,
Sep 28, 2012, 1:48:23 PM9/28/12
to pytho...@python.org
The Windows stat() call treats things differently,

FROM: http://msdn.microsoft.com/en-us/library/14h5k7ff%28v=vs.80%29.aspx

st_ctime

Time of creation of file. Valid on NTFS but not on FAT formatted disk drives.

I don't think that Windows has a concept of a "change time" for meta data
(though that would be nice). How's that for compatibility ;)

NOTE: I am a C programmer and new to python, so can anyone comment
on what the st_ctime value is when os.stat() is called on Windows?

Kris
--
This message is NOT encrypted
--------------------------------
Mr. Kristen J. Webb
Chief Technology Officer
Teradactyl LLC.
2301 Yale Blvd. SE.
Suite C7
Albuquerque, NM 87106
Phone: 1-505-338-6000
Email: kw...@teradactyl.com
Web: http://www.teradactyl.com

Home of the

True incremental Backup System
--------------------------------
NOTICE TO RECIPIENTS: Any information contained in or attached to this message
is intended solely for the use of the intended recipient(s). If you are not the
intended recipient of this transmittal, you are hereby notified that you
received this transmittal in error, and we request that you please delete and
destroy all copies and attachments in your possession, notify the sender that
you have received this communication in error, and note that any review or
dissemination of, or the taking of any action in reliance on, this communication
is expressly prohibited.


Regular internet e-mail transmission cannot be guaranteed to be secure or
error-free. Therefore, we do not represent that this information is complete or
accurate, and it should not be relied upon as such. If you prefer to communicate
with Teradactyl LLC. using secure (i.e., encrypted and/or digitally signed)
e-mail transmission, please notify the sender. Otherwise, you will be deemed to
have consented to communicate with Teradactyl via regular internet e-mail
transmission. Please note that Teradactyl reserves the right to intercept,
monitor, and retain all e-mail messages (including secure e-mail messages) sent
to or from its systems as permitted by applicable law.



Nobody

unread,
Sep 29, 2012, 3:24:14 PM9/29/12
to
On Fri, 28 Sep 2012 11:48:23 -0600, Kristen J. Webb wrote:

> NOTE: I am a C programmer and new to python, so can anyone comment
> on what the st_ctime value is when os.stat() is called on Windows?

The documentation[1] says:

st_ctime - platform dependent; time of most recent metadata change on
Unix, or the time of creation on Windows)

[1] http://docs.python.org/library/os#os.stat

0 new messages