If 1 more unit can be submitted to this leaky bucket without causing it to overflow, then return a time interval of 0 immediately. Otherwise, first update the state of this leaky bucket to the specified currentTime. Then, return the estimated time interval that should pass from currentTime until 1 more unit can be submitted to this leaky bucket without causing it to overflow. The number of nanoseconds in the returned time interval is rounded up. Note that a time interval of 0 can still be return after the state of this leaky bucket has been updated to currentTime. Also note that after waiting for the returned time interval, clients should typically check again using this method, because additional units may have been submitted in the interim. The behavior is undefined unless LLONG_MIN != currentTime.seconds() and the total number of seconds in the time interval resulting from currentTime ‐ lastUpdateTime() can be represented with a 64‐bit signed integer.
Synopsis
Declared in <balb_leakybucket.h>
bsls::TimeInterval
calculateTimeToSubmit(bsls::TimeInterval const& currentTime);
Created with MrDocs