cURL / Mailing Lists / curl-library / Single Mail


Re: Porting curlx_tvnow

From: Daniel Stenberg <>
Date: Fri, 19 Aug 2011 23:51:23 +0200 (CEST)

On Fri, 19 Aug 2011, Vladimir Grishchenko wrote:

> We can only get current time on our platform to the second precision, but
> there is a higher resolution system tick counter available. Looks like
> libcurl is using system ticks on Win32, does that mean that libcurl never
> needs actual current time (for like writing it out to headers or such) but
> only a monotonically increasing value? We are currently using the 1sec
> resolution clock for the curlx_tvnow port and it looks like switching to
> system ticks should be safe given its value doesn't wrap too often?
> Wondering if there will be any benefit of using higher-precision clock apart
> from getting more precise timing metrics?

We offer millisecond resolution timeout options. They will of course not work
very good without at least subsecond resolution on the timers. In fact, even
other timeouts will be more precise internally since we count all timeouts
using milliseconds.

When using the multi interface, we use a splay-tree that is sorted on "time
left to run" and if that is not higher resolution than full seconds it will
function a lot worse.

libcurl won't use the "wall time" for anything, so just taking a tick counter
like we do on windows should work perfectly fine.

List admin:
Received on 2011-08-19