2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

timeval: New function xclock_gettime().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
This commit is contained in:
Ben Pfaff
2013-07-11 16:50:15 -07:00
parent 9eba675da1
commit bc7ad7d474
2 changed files with 13 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ static void
refresh_wall(void)
{
time_init();
clock_gettime(CLOCK_REALTIME, &wall_time);
xclock_gettime(CLOCK_REALTIME, &wall_time);
wall_tick = false;
}
@@ -218,7 +218,7 @@ refresh_monotonic(void)
if (!time_stopped) {
if (monotonic_clock == CLOCK_MONOTONIC) {
clock_gettime(monotonic_clock, &monotonic_time);
xclock_gettime(monotonic_clock, &monotonic_time);
} else {
refresh_wall_if_ticked();
monotonic_time = wall_time;
@@ -460,6 +460,16 @@ xgettimeofday(struct timeval *tv)
}
}
void
xclock_gettime(clock_t id, struct timespec *ts)
{
if (clock_gettime(id, ts) == -1) {
/* It seems like a bad idea to try to use vlog here because it is
* likely to try to check the current time. */
ovs_abort(errno, "xclock_gettime() failed");
}
}
static long long int
timeval_diff_msec(const struct timeval *a, const struct timeval *b)
{