apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: cvs commit: apr/include apr_time.h
Date Wed, 12 Jun 2002 21:46:25 GMT
At 12:06 PM 6/12/2002, you wrote:
>On 12 Jun 2002 wrowe@apache.org wrote:
>
> >   +#define APR_TIME_USEC(time) ((apr_int32_t)(time) % APR_USEC_PER_SEC)
> >   +
> >   +#define APR_TIME_SEC(time) ((apr_int64_t)(time) / APR_USEC_PER_SEC)
> >   +
> >   +#define APR_TIME_FROM_SEC(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
> >   +
> >   +#define APR_TIME_MAKE(sec, usec) ((apr_time_t)(sec) * 
> APR_USEC_PER_SEC + usec)
>
>Aren't these all missing a set of parens?  In other words, I think the
>cast should occur after the division/multiplication.
>
>Such as:
>
>#define APR_TIME_USEC(time) ((apr_int32_t)((time) % APR_USEC_PER_SEC))
>
>etc.  No?

Well, in RPN

time [(apr_time_t]] Enter
APR_USEC_PER_SEC [(apr_time_t)1000000] Enter
Modulus [should be a 64 bit computation]

So the results should be fine.

At 12:18 PM 6/12/2002, Greg Marr wrote:
>Also, the last one doesn't have parens around usec.

That would be a problem, it should also be cast to apr_time_t.  Fix in a bit.

Bill


Mime
View raw message