[#BloombergLP-balb-LeakyBucket-calculateTimeWindow] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balb.adoc[balb]::xref:BloombergLP/balb/LeakyBucket.adoc[LeakyBucket]::calculateTimeWindow :relfileprefix: ../../../ :mrdocs: Return the time window approximated by a leaky bucket of given size. == Synopsis Declared in `<balb_leakybucket.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] calculateTimeWindow( xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64] drainRate, xref:BloombergLP/bsls/Types/Uint64.adoc[bsls::Types::Uint64] capacity); ---- == Description Return the time interval over which a leaky bucket _approximates_ a moving‐total of submitted units, as the rounded‐down ratio between the specified `capacity` and the specified `drainRate`. If the rounded ratio is 0, return a time interval of 1 nanosecond. The behavior is undefined unless `drainRate > 0` and `capacity / drainRate` can be represented with 64‐bit signed integral type. == Return Value time interval approximating the moving‐total window for the given capacity and drain rate == Parameters [cols="1,4"] |=== | Name| Description | *drainRate* | rate at which units drain from the bucket | *capacity* | capacity of the leaky bucket in units |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#