At 01:14 PM 7/9/2002, you wrote:
Bill Stoddard wrote:

Where and when was the post that described this proposal? I'd like to take a look. Is there a patch?

There's no patch that I know of, but here's the thread with wrowe's original proposal for the binary microseconds design: http://marc.theaimsgroup.com/?l=apr-dev&m=102376298728487&w=2

http://marc.theaimsgroup.com/?l=apr-dev&m=102383695930036&w=2

is a better link to some example macros.

With the big batch of changes that I made last week, almost all
of the time-related code in the httpd now uses the new macros--
apr_time_sec(), apr_time_usec(), etc--instead of multiplying and
dividing by 1,000,000 directly.  Hopefully that will make it
easier to try out a new time representation.

Agreed. But even discounting that USEC_PER_SEC is used for it's real meaning somewhere, and would introduce slight discrepancies, attached is simply the gross hack to force busec units.

Note the 'right' change is to have a BUSEC_PER_SEC constant,
but this is a truer test for benchmarking.

Bill




Index: include/apr_time.h
===================================================================
RCS file: /home/cvs/apr/include/apr_time.h,v
retrieving revision 1.54
diff -u -r1.54 apr_time.h
--- include/apr_time.h  2 Jul 2002 15:47:12 -0000       1.54
+++ include/apr_time.h  10 Jul 2002 16:47:32 -0000
@@ -92,19 +92,22 @@
 /** short interval for I/O timeouts, in microseconds */
 typedef apr_int32_t apr_short_interval_time_t;
 
-/** number of microseconds per second */
-#define APR_USEC_PER_SEC APR_TIME_C(1000000)
+/** number of binary microseconds per second (2^20) */
+#define APR_USEC_PER_SEC APR_TIME_C(1048576)
 
-#define apr_time_usec(time) ((apr_int32_t)((time) % APR_USEC_PER_SEC))
+#define apr_time_usec(time) ((apr_int32_t)((((time) % APR_USEC_PER_SEC) \
+                             * APR_TIME_C(1000000)) / APR_USEC_PER_SEC))
 
-#define apr_time_nsec(time) ((apr_int32_t)((time) % APR_USEC_PER_SEC) * 
(apr_int32_t)1000)
+#define apr_time_nsec(time) ((apr_int32_t)((((time) % APR_USEC_PER_SEC) \
+                          * APR_TIME_C(1000000000)) / 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 \
-                                + (apr_time_t)(usec))
+          + ((apr_time_t)(usec) * APR_TIME_C(1000000)) / APR_USEC_PER_SEC)
+
 
 /**
  * return the current time

Reply via email to