POSIX atime, mtime, ctime
如果你包含一个完整的文字及其实际和预期产出,而不是REPL的碎块,就可能有所帮助。
import sys, os, stat, time
def get_times(p):
s = os.stat(p)
return (
os.path.getatime(p),
os.path.getmtime(p),
os.path.getctime(p),
s[stat.ST_ATIME],
s[stat.ST_MTIME],
s[stat.ST_CTIME],
)
def main(p, delay=1):
delay = float(delay)
(a,b) = (1000000000, 1500000000)
open(p, w ).close()
print initial:
print get_times(p)
for t in [ (a,a), (a,b), (b,a), (b,b) ]:
print
print test: , t
os.utime(p,t)
print get_times(p)
time.sleep(delay)
print get_times(p)
main(*sys.argv[1:])
我在我的10.4个系统上取得了这一成绩,有<条码>c d“$HOME” &&python 测试。 py tempfile 5 (系统系统故障2.3.6和MacPorts-030 2.6.4均得出相同结果(当然包括初始时间和 /m>):
% python /tmp/test.py tempfile 5
initial:
(1000000000.0, 1000000000.0, 1269629881.0, 1000000000, 1000000000, 1269629881)
test: (1000000000, 1000000000)
(1000000000.0, 1000000000.0, 1269629881.0, 1000000000, 1000000000, 1269629881)
(1000000000.0, 1000000000.0, 1269629881.0, 1000000000, 1000000000, 1269629881)
test: (1000000000, 1500000000)
(1000000000.0, 1500000000.0, 1269629886.0, 1000000000, 1500000000, 1269629886)
(1000000000.0, 1500000000.0, 1269629886.0, 1000000000, 1500000000, 1269629886)
test: (1500000000, 1000000000)
(1500000000.0, 1000000000.0, 1269629891.0, 1500000000, 1000000000, 1269629891)
(1500000000.0, 1000000000.0, 1269629891.0, 1500000000, 1000000000, 1269629891)
test: (1500000000, 1500000000)
(1500000000.0, 1500000000.0, 1269629896.0, 1500000000, 1500000000, 1269629896)
(1500000000.0, 1500000000.0, 1269629896.0, 1500000000, 1500000000, 1269629896)
这似乎是合理的。 我想知道你们会怎样做。
我听到,Spotlight有时会因重新编篡改变了的档案而积极地重新启用atime。 我并不期望它重新编制只经过了假日/假日的文件,但我相信这样做是可能的。 在Spotlight(例如/tmp/testfile)未编入索引的地点,消除可能复杂化的Spotlight。
Date Created in Finder
(在Finder信息窗口中称为“混合:”)
如果安装了开发工具,你可使用<代码>/Developer/Tools/GetFileInfo>/code>,看家事科的创建情况。 我在每条<代码>印本上加上以下线:
sys.stdout.flush()
os.system( /Developer/Tools/GetFileInfo + p)
我也修改了标题,以与你的初始描述相一致([(a,b)、(a)、(a)、(b)、(b)、(b)]
)。
结果是:
% rm /tmp/tempfile; python /tmp/test.py /tmp/tempfile 1
initial:
(1269636574.0, 1269636574.0, 1269636574.0, 1269636574, 1269636574, 1269636574)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 03/26/2010 15:49:34
modified: 03/26/2010 15:49:34
test: (1000000000, 1500000000)
(1000000000.0, 1500000000.0, 1269636574.0, 1000000000, 1500000000, 1269636574)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 03/26/2010 15:49:34
modified: 07/13/2017 21:40:00
(1000000000.0, 1500000000.0, 1269636574.0, 1000000000, 1500000000, 1269636574)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 03/26/2010 15:49:34
modified: 07/13/2017 21:40:00
test: (1000000000, 1000000000)
(1000000000.0, 1000000000.0, 1269636576.0, 1000000000, 1000000000, 1269636576)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 09/08/2001 20:46:40
(1000000000.0, 1000000000.0, 1269636576.0, 1000000000, 1000000000, 1269636576)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 09/08/2001 20:46:40
test: (1500000000, 1000000000)
(1500000000.0, 1000000000.0, 1269636577.0, 1500000000, 1000000000, 1269636577)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 09/08/2001 20:46:40
(1500000000.0, 1000000000.0, 1269636577.0, 1500000000, 1000000000, 1269636577)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 09/08/2001 20:46:40
test: (1500000000, 1500000000)
(1500000000.0, 1500000000.0, 1269636578.0, 1500000000, 1500000000, 1269636578)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 07/13/2017 21:40:00
(1500000000.0, 1500000000.0, 1269636578.0, 1500000000, 1500000000, 1269636578)
file: "/private/tmp/tempfile"
type: ""
creator: ""
attributes: avbstclinmedz
created: 09/08/2001 20:46:40
modified: 07/13/2017 21:40:00
这似乎与你在Finder<>>>/em>上的Gefo之窗的意见一致。 我的解释(通过其他试验传播)是,建立爱阵设施。 日期按时段更新,但只是向后(不管向往)。 如果你想要更新爱幼学校的创造价值,那么你很可能不得不使用一种针对特定对象的软件来这样做。
另有一份说明:您可能不得不将窗户转开,以便更新Get窗户。 在我的系统中,除非我把窗户转到或从GetInfo窗户,否则其显示不会自动更新。