summaryrefslogtreecommitdiffstats
path: root/tools.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 15:27:13 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 15:27:13 +0100
commitd2dc73cab5b1c08822ce0066251e362f01525f10 (patch)
tree7ee30f3670a1df1d2acd0b84e64e8f3fdf7b47a3 /tools.c
parentd1a0a2e0322e6c5b05ba7817c1c0405dc20e5414 (diff)
downloadpcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.gz
pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.bz2
pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.xz
pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.zip
Minor fixes and improvements
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c8
1 files changed, 5 insertions, 3 deletions
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;
}