卷曲命令以获取时间

gau*_*tam 0 linux curl http

我正在运行 curl 命令:

curl -s -w "\n\n%{time_connect} + %{time_starttransfer} = %{time_total}\n\n" GET http://www.google.com
Run Code Online (Sandbox Code Playgroud)

我得到的回应是:

0.000 + 0.000 = 0.000

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.in/?gfe_rd=cr&amp;dcr=0&amp;ei=zWUAWsbbDabU-APf85KoBQ">here</A>.
</BODY></HTML>


0.217 + 0.416 = 0.417
Run Code Online (Sandbox Code Playgroud)

所以我不明白的一件事是为什么需要两个时间实例以及它们代表什么?

0.000 + 0.000 = 0.000

0.217 + 0.416 = 0.417
Run Code Online (Sandbox Code Playgroud)

skr*_*skr 7

您不需要GETincurl命令,它尝试GET并失败,并且该结果在第一个输出为零时给出。

GETcurl命令中删除并尝试。

curl -w "\n\n%{time_connect} + %{time_starttransfer} = %{time_total}\n" www.google.com 
Run Code Online (Sandbox Code Playgroud)