Skip to content
Snippets Groups Projects
Commit c8f5c38f authored by Russell Bryant's avatar Russell Bryant
Browse files

let the compiler learn the types for the elements of a struct timeval to fix

portability issues


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 11fae70f
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
#include "asterisk/inline_api.h" #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. * \brief Computes the difference (in milliseconds) between two \c struct \c timeval instances.
* \param end the beginning of the time period * \param end the beginning of the time period
...@@ -104,7 +111,7 @@ struct timeval ast_tv(int sec, int usec), ...@@ -104,7 +111,7 @@ struct timeval ast_tv(int sec, int usec),
) )
#endif #endif
AST_INLINE_API( 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; struct timeval t;
t.tv_sec = sec; t.tv_sec = sec;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment