openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/basic/ratelimit.c
bool ratelimit_below(RateLimit* r)
{
    usec_t ts;

    assert(r);

    if (r->interval <= 0 || r->burst <= 0)
        return true;

    ts = now(CLOCK_MONOTONIC);

    if (r->begin <= 0 || r->begin + r->interval < ts)
    {
        r->begin = ts;

        /* Reset counter */
        r->num = 0;
        goto good;
    }

    if (r->num < r->burst)
        goto good;

    return false;

good:
    r->num++;
    return true;
}
/* Modelled after Linux' lib/ratelimit.c by Dave Young
 * <hidave.darkstar@gmail.com>, which is licensed GPLv2. */
Modelled after Linux' lib/ratelimit.c by Dave Young
, which is licensed GPLv2.
Modelled after Linux ' lib / ratelimit . c by Dave Young which is licensed GPLv2 .
bool ratelimit_below(RateLimit* r)
{
    usec_t ts;
    assert(r);
    if (r->interval <= 0 || r->burst <= 0)
        return true;
    ts = now(CLOCK_MONOTONIC);
    if (r->begin <= 0 || r->begin + r->interval < ts)
    {
        r->begin = ts;
        r->num = 0;
        goto good;
    }
    if (r->num < r->burst)
        goto good;
    return false;
good:
    r->num++;
    return true;
}
bool ratelimit_below ( RateLimit * r ) { usec_t ts ; assert ( r ) ; if ( r -> interval <= 0 || r -> burst <= 0 ) return true ; ts = now ( CLOCK_MONOTONIC ) ; if ( r -> begin <= 0 || r -> begin + r -> interval < ts ) { r -> begin = ts ; r -> num = 0 ; goto good ; } if ( r -> num < r -> burst ) goto good ; return false ; good : r -> num ++ ; return true ; }
Modelled after Linux' lib/ratelimit.c by Dave Young
 <hidave.darkstar@gmail.com>, which is licensed GPLv2.
Modelled after Linux ' lib / ratelimit . c by Dave Young <hidave . darkstar@gmail . com > which is licensed GPLv2 .
/* Reset counter */