timer: Use a single definition of NSEC_PER_SEC for the whole codebase

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: c6e55468856ba0b8f95913c4da111cc0ef266541.1434113783.git.berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Alberto Garcia 2015-06-12 16:01:30 +03:00 committed by Stefan Hajnoczi
parent 471fae3c98
commit e0cf11f31c
9 changed files with 21 additions and 26 deletions

View file

@ -36,7 +36,7 @@ void throttle_leak_bucket(LeakyBucket *bkt, int64_t delta_ns)
double leak;
/* compute how much to leak */
leak = (bkt->avg * (double) delta_ns) / NANOSECONDS_PER_SECOND;
leak = (bkt->avg * (double) delta_ns) / NSEC_PER_SEC;
/* make the bucket leak */
bkt->level = MAX(bkt->level - leak, 0);
@ -72,7 +72,7 @@ static void throttle_do_leak(ThrottleState *ts, int64_t now)
*/
static int64_t throttle_do_compute_wait(double limit, double extra)
{
double wait = extra * NANOSECONDS_PER_SECOND;
double wait = extra * NSEC_PER_SEC;
wait /= limit;
return wait;
}