summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-12-13 00:41:01 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-12-13 00:41:56 +0000
commitfce5c23c3e21a41f8be6035408437fda63bac10a (patch)
treea02628a1e5d4c8d6f1ccd6be22634e643a8b6200 /src
parent5fae29d5b430d6a5f58c6c02cdefbbf307e258a9 (diff)
Handle kernels not providing microsecond time resolution
Diffstat (limited to 'src')
-rw-r--r--src/src/exim.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/src/exim.c b/src/src/exim.c
index 8c3c8e7ed..72bf65e72 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -407,7 +407,7 @@ long int now_true_usec;
now_true_usec = now_tv.tv_usec;
now_tv.tv_usec = (now_true_usec/resolution) * resolution;
-if (exim_tvcmp(&now_tv, then_tv) <= 0)
+while (exim_tvcmp(&now_tv, then_tv) <= 0)
{
struct itimerval itval;
itval.it_interval.tv_sec = 0;
@@ -439,6 +439,13 @@ if (exim_tvcmp(&now_tv, then_tv) <= 0)
}
milliwait(&itval);
+
+ /* Be prapared to go around if the kernel does not implement subtick
+ granularity (GNU Hurd) */
+
+ (void)gettimeofday(&now_tv, NULL);
+ now_true_usec = now_tv.tv_usec;
+ now_tv.tv_usec = (now_true_usec/resolution) * resolution;
}
}