You could use timeit.default_timer instead of time.time.
timeit.default_timer will choose the best timer (time.time, time.clock or time.perf_counter) for your system.
The resolution of the timer isn't unlimited; it goes up by small amounts periodically. If the two calls are close enough together, you will see a zero value. If you tried a large number of such calls, you would probably find that the difference is zero most of the time, and some number of microseconds the rest of the time, depending on your particular system's speed, hardware details, and kernel implementation.
참고자료 1 :
https://stackoverflow.com/questions/48196000/why-is-time-time-time-time-0-0
참고자료 2 :
https://stackoverflow.com/questions/33086519/why-time-time-gives-0-0
참고자료 3 : https://docs.python.org/ko/3/library/timeit.html
참고자료 4 : https://pymotw.com/2/timeit/
'Programming > Python' 카테고리의 다른 글
[Python] 파일명 추출, 디렉토리 경로 추출 (3) | 2020.11.20 |
---|---|
[Python] Python Schedule 모듈 이용하여 원하는 시간대에 프로그램 실행 시키기 (5) | 2020.11.02 |
[Python] Import 는 꼭 맨 윗줄에 써야하는가? (2) | 2020.04.17 |
[Python] 파일 읽고 쓰기 (0) | 2020.03.09 |
[Python] Anaconda 가상환경에서 spyder 실행하기 (Windows) (2) | 2020.02.07 |