Commit 31ef9f5178dee18 (timeval: Remove CACHE_TIME scheme.) inadvertently removed the ability to warp time forward, for use in tests, except when time is stopped. This fixes the problem.
Signed-off-by: Ben Pfaff <b...@nicira.com> --- lib/timeval.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/timeval.c b/lib/timeval.c index 3262397..7584d58 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -105,15 +105,22 @@ time_init(void) static void time_timespec__(struct clock *c, struct timespec *ts) { + struct timespec warp; + struct timespec cache; + bool stopped; + time_init(); - if (!c->stopped) { - xclock_gettime(c->id, ts); - } else { - ovs_rwlock_rdlock(&c->rwlock); - timespec_add(ts, &c->cache, &c->warp); - ovs_rwlock_unlock(&c->rwlock); + ovs_rwlock_rdlock(&c->rwlock); + stopped = c->stopped; + warp = c->warp; + cache = c->cache; + ovs_rwlock_unlock(&c->rwlock); + + if (!stopped) { + xclock_gettime(c->id, &cache); } + timespec_add(ts, &cache, &warp); } /* Stores a monotonic timer, accurate within TIME_UPDATE_INTERVAL ms, into -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev