[ovs-dev] [nxm 27/42] ofproto: Factor flow duration calculation into new calc_flow_duration().
Ben Pfaff
blp at nicira.com
Fri Nov 5 19:46:24 UTC 2010
On Fri, Nov 05, 2010 at 11:30:54AM -0700, Justin Pettit wrote:
> 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().
Thank you for that correction. (I was relieved when I saw that this was
a new bug; the code that this patch replaces was correct.)
More information about the dev
mailing list