apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject RE: Why not POSIX time_t?
Date Mon, 15 Jul 2002 14:16:38 GMT

> > >>If you mean using only second-resolution times, that's an option,
> > >>but not for the httpd.  One of the big problems with 1.3 was that
> > >>the request time was only stored with 1-second resolution.  We used
> > >>to have to add in custom, redundant time lookups to get better
> > >>resolution whenever we needed to instrument request duration or
> > >>log request times with higher precision.
> > >>
> > >>
> > >
> > >But http only requires 1 sec resolution.  If you want better than
> that,
> > >then you will have a performance hit.
> > >
> >
> > No you won't.  It's *faster* to get the time with
> > microsecond resolution than to get it with second
> > resolution.  (gettimeofday() is faster than time().)
>
> Then get the time with microsecond resolution in the thread, but only
> save second resolution.  This way, the 64-bit division is not happening
> in the middle of request processing.

It is useful to have microsecond resolution for logging time taken to handle
requests, etc.  We just need an efficient way to get 1 second resolution for
HTTP protocol use.

Bill



Mime
View raw message