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: watch out for thread_cond_timedwait problems
Date Tue, 02 Jul 2002 15:54:17 GMT
At 10:23 AM 7/2/2002, Brian Pane wrote:

>Do you get a correct tv_nsec if you remove the cast to 32-bit int
>in the apr_time_usec macro?

Yes and no... it isn't the cast (usec or nsec, for that matter, fit in a signed
32 bit integer.)  It was the order of evaluation;

>-#define apr_time_usec(time) ((apr_int32_t)(time) % APR_USEC_PER_SEC)
>+#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)

This isn't the right solution, IMHO.  I just committed this;

#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.


Mime
View raw message