|
reSIProcate
SIP stack, Dialog Usage Manager and related libraries
|
Clock used for timing in the Timer class and possibly other areas. More...
#include <Time.hxx>
Public Member Functions | |
| ResipClock (void) | |
| ~ResipClock (void) | |
Static Public Member Functions | |
| static uint64_t | getTimeMicroSec () |
| Returns the current clock time in microseconds. | |
| static uint64_t | getTimeMs () |
| Returns the current clock time in milliseconds. | |
| static uint64_t | getTimeSecs () |
| Returns the current clock time in seconds. | |
| static uint64_t | getRandomFutureTimeMs (uint64_t futureMs) |
| Returns an absolute time in ms that is between 50% and 90% of passed in ms from now. | |
| static uint64_t | getForever () |
| Infinit time in future. | |
| static unsigned | getMaxSystemTimeWaitMs (void) |
| Some monotonic clock implementations may internally only return 32-bit values that will wrap. | |
| static void | queryTimerInfo (unsigned &minRes, unsigned &maxRes, unsigned &actualRes, bool &isMonotonic) |
| Gets the current clock's minimum, maximum and current/actual timer resolution and returns if the clock is known to be monotonic. | |
Clock used for timing in the Timer class and possibly other areas.
Depending on the OS and compile settings this clock may not be monotonic. Define _RESIP_MONOTONIC_CLOCK to enable monotonic timers. The precision of this clock is available in microseconds, but the accuracy depends on other factors such as the OS and hardware. The time values returned by this class should be considered independent of any other clock time, including the system time (ie OS date/time,uptime,epoch,etc).
OS Specific notes:
Windows
When _RESIP_MONOTONIC_CLOCK is defined, timeGetTime() is currently used as the underyling time source.
The default resolution/accuracy of this timer on windows is usually the same as the system time clock.
To query resolution information use ResipClock::queryTimerInfo(). timeBeginPeriod() can be used to increase the resolution of the timer and allow for up to 1ms accuracy. This will improve the accuracy of SIP related timers governed by resip::Timer, but also has other OS wide implications, please refer to Microsoft's documenation on timeBeginPeriod() for more information.
When _RESIP_MONOTONIC_CLOCK is not defined, GetSystemTime is used as the underlying time source. This value can jump forward or backward (not monotonic) if the OS system time is adjusted. The default resolution of this timer is the current system clock interrupt time and cannot be set to a higher resolution. The resolution has been observed at approx 15ms on XP and 1ms on Vista.
POSIX
When _RESIP_MONOTONIC_CLOCK is defined, clock_gettime() is used with the CLOCK_MONOTONIC clock.
When _RESIP_MONOTONIC_CLOCK is not defined, gettimeofday() is used as the underyling clock.
OS X
A monotonic clock is currently not implemented for OS X. There appear to be a couple of choices. http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/ http://www.meandmark.com/timing.pdf http://developer.apple.com/qa/qa2004/qa1398.html
|
static |
|
inlinestatic |
Some monotonic clock implementations may internally only return 32-bit values that will wrap.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |