diff --git a/include/asterisk/time.h b/include/asterisk/time.h
index 4dfeb359eb7d81a364fc5b74381941a5f8fe9811..a10636a697753528b102faac7b3b8010a8006e02 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;