openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnss-mdns/0.10-r7/nss-mdns-0.10/src/util.c
usec_t timeval_diff(const struct timeval* a, const struct timeval* b)
{
    usec_t r;
    assert(a && b);

    /* Check which whan is the earlier time and swap the two arguments if
     * reuqired. */
    if (timeval_cmp(a, b) < 0)
    {
        const struct timeval* c;
        c = a;
        a = b;
        b = c;
    }

    /* Calculate the second difference*/
    r = ((usec_t)a->tv_sec - b->tv_sec) * 1000000;

    /* Calculate the microsecond difference */
    if (a->tv_usec > b->tv_usec)
        r += ((usec_t)a->tv_usec - b->tv_usec);
    else if (a->tv_usec < b->tv_usec)
        r -= ((usec_t)b->tv_usec - a->tv_usec);

    return r;
}
/* Calculate the difference between the two specfified timeval
 * timestamsps. */
Calculate the difference between the two specfified timeval
timestamsps.
Calculate the difference between the two specfified timeval timestamsps .
usec_t timeval_diff(const struct timeval* a, const struct timeval* b)
{
    usec_t r;
    assert(a && b);
    if (timeval_cmp(a, b) < 0)
    {
        const struct timeval* c;
        c = a;
        a = b;
        b = c;
    }
    r = ((usec_t)a->tv_sec - b->tv_sec) * 1000000;
    if (a->tv_usec > b->tv_usec)
        r += ((usec_t)a->tv_usec - b->tv_usec);
    else if (a->tv_usec < b->tv_usec)
        r -= ((usec_t)b->tv_usec - a->tv_usec);
    return r;
}
usec_t timeval_diff ( const struct timeval * a , const struct timeval * b ) { usec_t r ; assert ( a && b ) ; if ( timeval_cmp ( a , b ) < 0 ) { const struct timeval * c ; c = a ; a = b ; b = c ; } r = ( ( usec_t ) a -> tv_sec - b -> tv_sec ) * 1000000 ; if ( a -> tv_usec > b -> tv_usec ) r += ( ( usec_t ) a -> tv_usec - b -> tv_usec ) ; else if ( a -> tv_usec < b -> tv_usec ) r -= ( ( usec_t ) b -> tv_usec - a -> tv_usec ) ; return r ; }
Calculate the difference between the two specfified timeval
 timestamsps.
Calculate the difference between the two specfified timeval timestamsps .
/* Check which whan is the earlier time and swap the two arguments if
     * reuqired. */ /* Calculate the second difference*/ /* Calculate the microsecond difference */