apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <brian.p...@cnet.com>
Subject Re: apr_time_t --> apr_time_usec_t
Date Tue, 11 Jun 2002 03:14:06 GMT
William A. Rowe, Jr. wrote:

> At 09:31 PM 6/10/2002, I wrote:
>
>> usec * 1048575 / 1000000 = busec
>>
>> bsec * 1000000 / 1048575 = usec
>
>
> whoops, s/1048575/1048576/ 


That's a major improvement.  I was going to complain about
the need for both a 64-bit multiplication and a 64-bit
division to do the conversion, but 1048576 only requires a
shift.

In general, I like this design:

* It combines most of the benefits of the "struct apr_timeval"
  approach with most of the benefits of the current 
seconds*1000000+microseconds
  scalar representation.

* It leaves 44 bits of a 64-bit representation free to hold the
  time_t, so it won't overflow for a few hundred thousand years.

* And the transition is easy: just change APR_USEC_PER_SEC to 1048576
  and tell all users of APR to recompile.

+1 for the binary microseconds implementation
-0 for continuing to call it apr_time_t

--Brian



Mime
View raw message