확인하기 위해 (파이썬) 코드의 예 조각을 가지고정확도
import unittest
import project_creator
import os
import time
class tests(unittest.TestCase):
def setUp(self):
os.makedirs('autotest')
f = open(os.path.join('autotest', 'new_file.txt'), 'w')
f.write('New file')
def tearDown(self):
os.unlink(os.path.join('autotest', 'new_file.txt'))
os.rmdir('autotest')
def test_amend_file(self):
changed = project_creator.watch('autotest', {})
time.sleep(2)
f = open(os.path.join('autotest', 'new_file.txt'), 'a')
f.write('\nA change!')
f.close()
changed = project_creator.watch('autotest', changed[0])
self.assertEqual(changed[1], [os.path.abspath(os.path.join('autotest', 'new_file.txt'))])
if __name__ == '__main__':
unittest.main()
통계가 실제로 1 초 정확도보다 나 빠지나요? (편집 : 외관상으로는 FAT 사용) 더 빠른 변경을 감지하는 (크로스 플랫폼) 방법이 있습니까?
참조 http://stackoverflow.com/questions/943503/python-getting-file-modification-times-with-greater-resolution-than-a-second. – unwind
고마워요, 그 첫 번째 질문에 대한 답변 (이전에 검색했을 때 내 google-fu는 분명히 부족했습니다). 나는 여전히 대체 방법에 관심이있다 (있는 경우). – mavnn