From d2dc73cab5b1c08822ce0066251e362f01525f10 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 12 Dec 2011 15:27:13 +0100 Subject: Minor fixes and improvements --- tools.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools.c') diff --git a/tools.c b/tools.c index 8fce755..4105597 100644 --- a/tools.c +++ b/tools.c @@ -332,9 +332,11 @@ int pcilib_sleep_until_deadline(struct timeval *tv) { pcilib_timeout_t duration; duration = pcilib_calc_time_to_deadline(tv); - wait.tv_sec = duration / 1000000; - wait.tv_nsec = 1000 * (duration % 1000000); - nanosleep(&wait, NULL); + if (duration > 0) { + wait.tv_sec = duration / 1000000; + wait.tv_nsec = 1000 * (duration % 1000000); + nanosleep(&wait, NULL); + } return 0; } -- cgit v1.2.3