[Asterisk-cvs] asterisk/include/asterisk time.h,1.5,1.6

russell at lists.digium.com russell at lists.digium.com
Tue Jul 19 14:59:01 CDT 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv18242/include/asterisk

Modified Files:
	time.h 
Log Message:
let the compiler learn the types for the elements of a struct timeval to fix
portability issues


Index: time.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/time.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- time.h	19 Jul 2005 15:30:31 -0000	1.5
+++ time.h	19 Jul 2005 19:06:24 -0000	1.6
@@ -16,6 +16,13 @@
 
 #include "asterisk/inline_api.h"
 
+/* We have to let the compiler learn what types to use for the elements of a
+   struct timeval since on linux, it's time_t and suseconds_t, but on *BSD,
+   they are just a long. */
+extern struct timeval tv;
+typedef typeof(tv.tv_sec) ast_time_t;
+typedef typeof(tv.tv_usec) ast_suseconds_t;
+
 /*!
  * \brief Computes the difference (in milliseconds) between two \c struct \c timeval instances.
  * \param end the beginning of the time period
@@ -104,7 +111,7 @@
 )
 #endif
 AST_INLINE_API(
-struct timeval ast_tv(time_t sec, suseconds_t usec),
+struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec),
 {
 	struct timeval t;
 	t.tv_sec = sec;




More information about the svn-commits mailing list