diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-19 19:06:24 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-19 19:06:24 +0000 |
commit | d03367cafcf78ba084b460c8a3555405e54362ed (patch) | |
tree | c6421805af206c2810c0c0b3da797e6f2bbed92c | |
parent | 524b1abe1de8cee34c7bc3cdf10ab9a688e66742 (diff) |
let the compiler learn the types for the elements of a struct timeval to fix
portability issues
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6164 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | include/asterisk/time.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/asterisk/time.h b/include/asterisk/time.h index 4dfeb359e..a10636a69 100755 --- a/include/asterisk/time.h +++ b/include/asterisk/time.h @@ -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 @@ struct timeval ast_tv(int sec, int usec), ) #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; |