#include <sys/time.h>
#include "asterisk/inline_api.h"
Go to the source code of this file.
Functions | |
AST_INLINE_API (struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec),{struct timeval t;t.tv_sec=sec;t.tv_usec=usec;return t;}) AST_INLINE_API(struct timeval ast_samp2tv(unsigned int _nsamp | |
Returns a timeval from sec, usec Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to timevals, or even milliseconds to timevals in the form ast_samp2tv(milliseconds, 1000). | |
AST_INLINE_API (int ast_tvdiff_ms(struct timeval end, struct timeval start),{return((end.tv_sec-start.tv_sec)*1000)+(((1000000+end.tv_usec-start.tv_usec)/1000)-1000);}) AST_INLINE_API(int ast_tvzero(const struct timeval t) | |
Computes the difference (in milliseconds) between two struct timeval instances. Returns true if the argument is 0,0. | |
timeval | ast_tvsub (struct timeval a, struct timeval b) |
Returns the difference of two timevals a - b. | |
typedef | typeof (tv.tv_sec) ast_time_t |
Variables | |
unsigned int | _rate |
timeval | tv |
Definition in file time.h.
|
Returns a timeval from sec, usec Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to timevals, or even milliseconds to timevals in the form ast_samp2tv(milliseconds, 1000).
|
|
Computes the difference (in milliseconds) between two
|
|
Returns the difference of two timevals a - b.
Definition at line 640 of file utils.c. References ast_tvsub(), and tvfix(). Referenced by ast_channel_bridge(), ast_sched_dump(), ast_translate(), ast_tvsub(), calc_rxstamp(), and calc_timestamp(). 00641 { 00642 /* consistency checks to guarantee usec in 0..999999 */ 00643 a = tvfix(a); 00644 b = tvfix(b); 00645 a.tv_sec -= b.tv_sec; 00646 a.tv_usec -= b.tv_usec; 00647 if (a.tv_usec < 0) { 00648 a.tv_sec-- ; 00649 a.tv_usec += ONE_MILLION; 00650 } 00651 return a; 00652 }
|
|
|
|
|
|