apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bri...@apache.org>
Subject interval times Re: watch out for thread_cond_timedwait problems
Date Tue, 02 Jul 2002 18:13:58 GMT
William A. Rowe, Jr. wrote:

> #define apr_time_usec(time) ((apr_int32_t)((time) % APR_USEC_PER_SEC))
>
> which will take the big number's modulos before truncating to 32 bits.



Thanks.  Speaking of the time_macros, I've only converted about
half of the instances of "time / APR_USEC_PER_SEC" in httpd-2.0
and APR to use to the macros.  The other half are operations on
apr_interval_time_t, rather than apr_time_t.

If we change apr_time_t to use binary microseconds, we'll have to
decide whether to do the same for apr_interval_time_t.

I see strong points both for and against changing apr_interval_time_t:

  - Interval times often are added to absolute times, so they should
    use the same format as absolute times so the additions won't
    produce unexpected errors.

  - On the other hand, interval times often are used as arguments to
    things like select calls, so they should use decimal microseconds
    to prevent unexpected errors when a programmer says something like,
    "I need my poll to block for 5 seconds at most, so I'll pass it a
    timeout of 5,000,000."

Does anyone else have a strong opinion on whether interval times should
always use the same representation as apr_time_t?

Thanks,
--Brian



Mime
View raw message