mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
Calculate tvdiff properly (avoid off-by-one)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2546,7 +2546,11 @@ int ast_setstate(struct ast_channel *chan, int state)
|
|||||||
|
|
||||||
static long tvdiff(struct timeval *now, struct timeval *then)
|
static long tvdiff(struct timeval *now, struct timeval *then)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
return (((now->tv_sec * 1000) + now->tv_usec / 1000) - ((then->tv_sec * 1000) + then->tv_usec / 1000));
|
return (((now->tv_sec * 1000) + now->tv_usec / 1000) - ((then->tv_sec * 1000) + then->tv_usec / 1000));
|
||||||
|
#else
|
||||||
|
return (now->tv_sec - then->tv_sec) * 1000 + (now->tv_usec - then->tv_usec) / 1000;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
|
struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
|
||||||
|
|||||||
Reference in New Issue
Block a user