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

Name

Description

numUnits

number of units to drain

drainRate

rate at which units drain

ceilFlag

if true, round nanoseconds up; otherwise round down

Created with MrDocs