You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2008/10/21 01:35:04 UTC

svn commit: r706458 - /apr/apr/trunk/include/apr_time.h

Author: wrowe
Date: Mon Oct 20 16:35:03 2008
New Revision: 706458

URL: http://svn.apache.org/viewvc?rev=706458&view=rev
Log:
A new macro for apr 1.4/2.0, for msec resolution - apr_time_from_sec(x*1000) is clumsy

Modified:
    apr/apr/trunk/include/apr_time.h

Modified: apr/apr/trunk/include/apr_time.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_time.h?rev=706458&r1=706457&r2=706458&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_time.h (original)
+++ apr/apr/trunk/include/apr_time.h Mon Oct 20 16:35:03 2008
@@ -72,7 +72,10 @@
 /** @return apr_time_t as a msec */
 #define apr_time_as_msec(time) ((time) / 1000)
 
-/** @return a second as an apr_time_t */
+/** @return milliseconds as an apr_time_t */
+#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000)
+
+/** @return seconds as an apr_time_t */
 #define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
 
 /** @return a second and usec combination as an apr_time_t */



Re: svn commit: r706458 - /apr/apr/trunk/include/apr_time.h

Posted by Mladen Turk <mt...@apache.org>.
wrowe@apache.org wrote:
> URL: http://svn.apache.org/viewvc?rev=706458&view=rev
> Log:
> A new macro for apr 1.4/2.0, for msec resolution - apr_time_from_sec(x*1000) is clumsy
>

That's cool!

What do you think of adding some apr_time_diff_* macros.
For example:

#define apr_time_diff_sec(t1, t2)  (apr_time_sec(t1) - apr_time_sec(t2))
#define apr_time_diff_msec(t1, t2) (apr_time_from_msec(t1) - 
apr_time_from_msec(t2))

Those would give only full sec or msec difference without
real resolution fraction.

Regards
-- 
^(TM)