summaryrefslogtreecommitdiff
path: root/include/asterisk/time.h
AgeCommit message (Collapse)Author
2012-11-07Multiple revisions 375993-375994Mark Michelson
........ r375993 | mmichelson | 2012-11-07 11:01:13 -0600 (Wed, 07 Nov 2012) | 30 lines Fix misuses of timeouts throughout the code. Prior to this change, a common method for determining if a timeout was reached was to call a function such as ast_waitfor_n() and inspect the out parameter that told how many milliseconds were left, then use that as the input to ast_waitfor_n() on the next go-around. The problem with this is that in some cases, submillisecond timeouts can occur, resulting in the out parameter not decreasing any. When this happens thousands of times, the result is that the timeout takes much longer than intended to be reached. As an example, I had a situation where a 3 second timeout took multiple days to finally end since most wakeups from ast_waitfor_n() were under a millisecond. This patch seeks to fix this pattern throughout the code. Now we log the time when an operation began and find the difference in wall clock time between now and when the event started. This means that sub-millisecond timeouts now cannot play havoc when trying to determine if something has timed out. Part of this fix also includes changing the function ast_waitfor() so that it is possible for it to return less than zero when a negative timeout is given to it. This makes it actually possible to detect errors in ast_waitfor() when there is no timeout. (closes issue ASTERISK-20414) reported by David M. Lee Review: https://reviewboard.asterisk.org/r/2135/ ........ r375994 | mmichelson | 2012-11-07 11:08:44 -0600 (Wed, 07 Nov 2012) | 3 lines Remove some debugging that accidentally made it in the last commit. ........ Merged revisions 375993-375994 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375995 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376014 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-27Prevent overflow in calculation in ast_tvdiff_ms on 32-bit machinesMatthew Jordan
The method ast_tvdiff_ms attempts to calculate the difference, in milliseconds, between two timeval structs, and return the difference in a 64-bit integer. Unfortunately, it assumes that the long tv_sec/tv_usec members in the timeval struct are large enough to hold the calculated values before it returns. On 64-bit machines, this might be the case, as a long may be 64-bits. On 32-bit machines, however, a long may be less (32-bits), in which case, the calculation can overflow. This overflow caused significant problems in MixMonitor, which uses the method to determine if an audio factory, which has not presented audio to an audiohook, is merely late in providing said audio or will never provide audio. In an overflow situation, the audiohook would incorrectly determine that an audio factory that will never provide audio is merely late instead. This led to situations where a MixMonitor never recorded any audio. Note that this happened most frequently when that MixMonitor was started by the ConfBridge application itself, or when the MixMonitor was attached to a Local channel. (issue ASTERISK-19497) Reported by: Ben Klang Tested by: Ben Klang Patches: 32-bit-time-overflow-10-2012-04-26.diff (license #6283) by mjordan (closes issue ASTERISK-19727) Reported by: Mark Murawski Tested by: Michael L. Young Patches: 32-bit-time-overflow-2012-04-27.diff (license #6283) by mjordan) (closes issue ASTERISK-19471) Reported by: feyfre Tested by: feyfre (issue ASTERISK-19426) Reported by: Johan Wilfer Review: https://reviewboard.asterisk.org/r/1889/ ........ Merged revisions 364277 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 364285 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364287 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-22Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd ↵David Vossel
audio ConfBridge, and other stuff -Functional changes 1. Dynamic global format list build by codecs defined in codecs.conf 2. SILK 8khz, 12khz, 16khz, and 24khz with custom attributes defined in codecs.conf 3. Negotiation of SILK attributes in chan_sip. 4. SPEEX 32khz with translation 5. SLINEAR 8khz, 12khz, 24khz, 32khz, 44.1khz, 48khz, 96khz, 192khz with translation using codec_resample.c 6. Various changes to RTP code required to properly handle the dynamic format list and formats with attributes. 7. ConfBridge now dynamically jumps to the best possible sample rate. This allows for conferences to take advantage of HD audio (Which sounds awesome) 8. Audiohooks are no longer limited to 8khz audio, and most effects have been updated to take advantage of this such as Volume, DENOISE, PITCH_SHIFT. 9. codec_resample now uses its own code rather than depending on libresample. -Organizational changes Global format list is moved from frame.c to format.c Various format specific functions moved from frame.c to format.c Review: https://reviewboard.asterisk.org/r/1104/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-18Extend max call limit duration from 24.8 days to 292+ million years.Jeff Peeler
If the limit was set past MAX_INT upon answering, the call was immediately hung up due to overflow from the return of ast_tvdiff_ms (in ast_check_hangup). The time calculation functions ast_tvdiff_sec and ast_tvdiff_ms have been changed to return an int64_t to prevent overflow. Also the reporter suggested adding a message indicating the reason for the call hanging up. Given that the new limit is so much higher, the message (which would only really be useful in the overflow scenario) has been made a debug message only. (closes issue #16006) Reported by: viraptor git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-09Merged revisions 205599 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r205599 | dvossel | 2009-07-09 11:18:09 -0500 (Thu, 09 Jul 2009) | 2 lines Changing ast_samp2tv to not use floating point. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-07-08Merged revisions 205215 via svnmerge from David Vossel
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r205215 | dvossel | 2009-07-08 11:53:40 -0500 (Wed, 08 Jul 2009) | 10 lines ast_samp2tv needs floating point for 16khz audio In ast_samp2tv(), (1000000 / _rate) = 62.5 when _rate is 16000. The .5 is currently stripped off because we don't calculate using floating points. This causes madness with 16khz audio. (issue ABE-1899) Review: https://reviewboard.asterisk.org/r/305/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@205216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-02Fix a bunch of places where \arg was used instead of \param. Using \argRussell Bryant
to document arguments seems logical, and does work, but is not the best thing to use. \arg in doxygen is simply for creating non-nested unordered lists. \param is the correct tag to use to document function parameters, and will come out better in the generated documentation. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-15Fix up some doxygen issues.Jason Parker
(closes issue #11996) Patches: bug_11996_doxygen.diff uploaded by snuffy (license 35) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-19Add a couple of new time API calls - ast_tvdiff_sec and ast_tvdiff_usecRussell Bryant
(closes issue #11270) Reported by: dimas Patches: tvdiff_us-4.patch uploaded by dimas (license 88) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-17Merged revisions 93336 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r93336 | tilghman | 2007-12-17 15:12:42 -0600 (Mon, 17 Dec 2007) | 6 lines Today is tomorrow's yesterday, and yesterday's tomorrow is today, and tomorrow's tomorrow is the day after tomorrow, so who cares if you recycle anyway? If this confuses you, that's nothing compared to what this fixes. ;-) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-11Merged revisions 68814 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r68814 | qwell | 2007-06-11 16:20:15 -0500 (Mon, 11 Jun 2007) | 2 lines Solaris 10 sometimes (?) needs this include in order to have NULL defined. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68816 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29remove extraneous svn:executable propertiesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-01add new GCC-specific macro and force inlining of certain functions where ↵Kevin P. Fleming
speed is paramount, even when optimization is disabled git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-24Doxygen documentation update from oej (issue #5505)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-30major header file cleanup: license, copyrights, descriptions, markers, etc.Kevin P. Fleming
remove deprecated config_old.c/config_old.h remove unused cvsid.h git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-19restore proper difference calculation (bug #4746)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-19let the compiler learn the types for the elements of a struct timeval to fixRussell Bryant
portability issues git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-19fix negative timestamp issueRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6160 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-15add a library of timeval manipulation functions, and change a large number ↵Kevin P. Fleming
of usses to use the new functions (bug #4504) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-11simplify (and document!) macro for inlinable API functions (inspired by bug ↵Kevin P. Fleming
#4603, with slightly different implementation) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-11reverse arguments to ast_tvdiff_ms, so they match the 'raw' math being used ↵Kevin P. Fleming
between the arguments git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6083 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-24add new header filesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6009 65c4cc65-6c06-0410-ace0-fbb531ad65f3