[ovs-dev] [nxm 27/42] ofproto: Factor flow duration calculation into new calc_flow_duration().

Justin Pettit jpettit at nicira.com
Fri Nov 5 18:30:54 UTC 2010


On Oct 28, 2010, at 10:27 AM, Ben Pfaff wrote:

> static void
> +calc_flow_duration(long long int start, ovs_be32 *sec, ovs_be32 *nsec)
> +{
> +    long long int msecs = time_msec() - start;
> +    *sec = htonl(msecs / 1000);
> +    *nsec = htonl(msecs % 1000);
> +}

Won't that nsec calculation just give you the number of milliseconds with seconds removed, and not nanoseconds?  I think you need to multiply that number by 1,000,000 before doing the htonl().

Otherwise, it looks good.

--Justin






More information about the dev mailing list