On May 28 21:39, Mitch Deoudes wrote: > According to the python docs, os.stat() gives the following for st_ctime: > > "|st_ctime| - platform dependent; time of most recent metadata change on > Unix, or the time of creation on Windows" > > To reproduce: > 1) touch foo > 2) wait a minute > 3) touch foo > 4) use python's os.stat() on the file foo > > cygwin's python 2.7.10 gives (me) the same number for mtime, ctime, and > atime: > > posix.stat_result(st_mode=33276, st_ino=40532396646393057, > st_dev=1079873317, st_nlink=1, st_uid=1001, st_gid=513, st_size=0, > st_atime=1464482278, st_mtime=1464482278, st_ctime=1464482278) > > However, cygwin's built-in stat command gives (correctly) the addtional > "birth time", which is different: > > Access: 2016-05-28 20:37:58.748977000 -0400 > Modify: 2016-05-28 20:37:58.748977000 -0400 > Change: 2016-05-28 20:37:58.748977000 -0400 > Birth: 2016-05-28 20:36:34.514159100 -0400 > > The non-cygwin version of Windows python from python.org (v2.7.11) behaves > correctly as per spec: > > nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0L, st_nlink=0, > st_uid=0, st_gid=0, st_size=0L, st_atime=1464482278L, st_mtime=1464482278L, > st_ctime=1464482194L) > > Am I missing something, or is this a bug in cygwin's python? You could > argue that ctime is properly "change" and not "birth", but that's not what > the python spec says it should be on Windows.
Cygwin's ctime is Change time, not Birth time, that's why Cygwin's stat structure comes with an additional st_birthtime as on the BSDs. I have no idea if python has a compile time option to make st_birthtime visible, though. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature