
time(), time_ns()
import time
current_time = time.time()
print('The current time is', current_time) # Output: 1688807663.873429
start_time = time.time()
time.sleep(1)
end_time = time.time()
print(f"{end_time - start_time:.4f} s") # Output: 1.0123 smonotonic(), monotonic_ns()
範例 – 速率限制器
速率限制器 – 正式版
速率限制器 – Pythonic
範例 – Token 存儲桶速率限制器
perf_counter(), perf_counter_ns()
process_time(), process_time_ns()
thread_time(), thread_time_ns()
Last updated