BloombergLP::balb::LeakyBucket::calculateDrainTime

Return the time interval required to drain the specified units.

Synopsis

Declared in <balb_leakybucket.h>

static
bsls::TimeInterval
calculateDrainTime(
    bsls::Types::Uint64 numUnits,
    bsls::Types::Uint64 drainRate,
    bool ceilFlag);

Description

Return the time interval required to drain the specified numUnits at the specified drainRate, round up the number of nanoseconds in the time interval if the specified ceilFlag is set to true, otherwise, round down the number of nanoseconds. The behavior is undefined unless the number of seconds in the calculated interval may be represented by a 64-bit signed integral type.

Return Value

time interval required to drain numUnits at drainRate

Parameters

NameDescription
numUnitsnumber of units to drain
drainRaterate at which units drain
ceilFlagif true, round nanoseconds up; otherwise round down