Add request timestamp with CURL Add request timestamp with CURL curl curl

Add request timestamp with CURL


If I'm understanding and you're wanting to measure latency client-side where curl is, you can use --write-outHow do I measure request and response times at once using cURL?

Server-side, unless someone customized the log, every hit to the server should log both date and time in the access_log

::1 - - [25/Mar/2016:22:37:54 -0700] "GET / HTTP/1.1" 200 38

EDIT:

Okay, given what you want.. not sure what it would show, since requests take portions of seconds, and clocks on different computers aren't necessarily the same. Nevertheless, to send the client's date with the curl request, you can capture the timestamp and send it as part of a custom user-agent using the -A option.

e.g. if in a unix bash shell that supports nanoseconds

curl -A `date +"[mycurltime:%Y-%m-%dT%H:%M:%S.%3N]"` "http://hostname/etc"

results in...

your.ip.addy - - [26/Mar/2016:16:52:54 -0700] "GET /etc HTTP/1.1" 200 7502 "-" "[mycurltime:2016-03-26T16:52:54.437]"