[ovs-dev] [PATCH] tests: Allow some difference in rounding in timeval test.
jesse at nicira.com
Thu Jun 10 16:54:27 PDT 2010
On Thu, Jun 10, 2010 at 4:44 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Thu, Jun 10, 2010 at 04:40:58PM -0700, Jesse Gross wrote:
> > We now use a time source that provides nanosecond granularity.
> > However, our test uses gettimeofday() for comparision, which has
> > microsecond granularity. In some cases this can lead to different
> > values depending on the rounding. This allows us to be off by one
> > to prevent intermittent test failures.
> Would it be better to change gettimeofday_in_msec() to use
> clock_gettime() if available and then call timespec_to_msec() on it?
> Presumably that would fix the race.
We could but I like the idea that the test uses a completely different
method of accessing the time from the thing it is testing. This is
especially true for this test because it is really testing the platform that
it is running on as much as it is testing our code. gettimeofday() is the
most common and least likely to have problems so it really seems the best to
use as a point of comparison.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dev