当定时器模块使用 default_timer 时,'unit of output time' 是什么?

What is the 'unit of output time' when default_timer is used from timer module?

我正在尝试找出此程序(“斐波那契数列”)到 运行 所花费的时间。

from timeit import default_timer as timer
n=int(input())
start = timer()
li=[0,1,1]
if n==1:
    print(li[0])
elif n==2 or n==3:
    print(li[1])
else:
    for i in range(n-3):
        x=li[-1]+li[-2]
        li.append(x)
print(li[-1])
print("{}".format(timer()-start))

我给输入 100 我得到的输出为

218922995834555169026
0.0004896000000371714

第一行是斐波那契答案,第二行是所用时间,我想知道这个时间的单位是什么? '0.0004896000000371714' 这个值是什么意思?

以秒为单位;请参阅文档:默认计时器通常指向 time.perf_counter function. You can use time.perf_counter_ns 纳秒。

如果您检查 timer,您会看到它是 <function time.perf_counter> 或类似的结果。