diff options
| author | 2011-03-17 20:16:42 -0700 | |
|---|---|---|
| committer | 2011-03-17 20:16:42 -0700 | |
| commit | f98f1364f802d7637b0304722f38efdfed758e6e (patch) | |
| tree | b92aea7cc73c8e898d9dbec71a85547ec4d24687 /include/utils/Timers.h | |
| parent | e5e02aac299bd0f864677ab62ebd804d79f69d44 (diff) | |
| parent | c0a5e8df03d949cb307a0eb98f0222086c0434c1 (diff) | |
Merge "Refactor how timeouts are calculated."
Diffstat (limited to 'include/utils/Timers.h')
| -rw-r--r-- | include/utils/Timers.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/utils/Timers.h b/include/utils/Timers.h index 9a9e07c602..8b4d322873 100644 --- a/include/utils/Timers.h +++ b/include/utils/Timers.h @@ -88,6 +88,16 @@ nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC); nsecs_t systemTime(int clock); #endif // def __cplusplus +/** + * Returns the number of milliseconds to wait between the reference time and the timeout time. + * If the timeout is in the past relative to the reference time, returns 0. + * If the timeout is more than INT_MAX milliseconds in the future relative to the reference time, + * such as when timeoutTime == LLONG_MAX, returns -1 to indicate an infinite timeout delay. + * Otherwise, returns the difference between the reference time and timeout time + * rounded up to the next millisecond. + */ +int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime); + #ifdef __cplusplus } // extern "C" #endif |