code
import time import datetime t1=time.time() time.sleep(0.02) t2=time.time() print("相差",(datetime.datetime.fromtimestamp(t2)-datetime.datetime.fromtimestamp(t1)).microseconds/1000.0,"ms")
原文:https://www.cnblogs.com/sea-stream/p/14049844.html