summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-27 14:45:17 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-27 14:45:17 +0000
commitea7fd874d7b294dacc909a0f8e9c51dcc639d879 (patch)
treecca6362933bc734907e5c6f99360eafe2d5c738f
parentcd6501b3417262a4377b3944d386f72a26c82864 (diff)
downloadrsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.tar.gz
rsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.tar.xz
rsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.zip
fixed a cosmetic issue in timeoutValue calculation (just used for
displaying)
-rwxr-xr-xsrUtils.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/srUtils.c b/srUtils.c
index 3d30f5a2..7e585ad7 100755
--- a/srUtils.c
+++ b/srUtils.c
@@ -321,16 +321,11 @@ timeoutComp(struct timespec *pt, long iTimeout)
assert(pt != NULL);
/* compute timeout */
clock_gettime(CLOCK_REALTIME, pt);
-RUNLOG_VAR("%ld", pt->tv_nsec);
pt->tv_nsec += (iTimeout % 1000) * 1000000; /* think INTEGER arithmetic! */
-RUNLOG_VAR("%ld", pt->tv_nsec);
if(pt->tv_nsec > 999999999) { /* overrun? */
-RUNLOG;
pt->tv_nsec -= 1000000000;
}
-RUNLOG_VAR("%ld", pt->tv_sec);
pt->tv_sec += iTimeout / 1000;
-RUNLOG_VAR("%ld", pt->tv_sec);
return RS_RET_OK; /* so far, this is static... */
}
@@ -349,19 +344,8 @@ timeoutVal(struct timespec *pt)
assert(pt != NULL);
/* compute timeout */
clock_gettime(CLOCK_REALTIME, &t);
- if(pt->tv_sec < t.tv_sec) {
- iTimeout = 0; /* in the past! */
- } else if(pt->tv_sec == t.tv_sec) {
- if(pt->tv_nsec < t.tv_nsec) {
- iTimeout = 0; /* in the past! */
- } else {
- iTimeout = (pt->tv_nsec - t.tv_nsec) / 1000;
- }
- } else {
- iTimeout = (pt->tv_sec - t.tv_sec) * 1000;
- iTimeout += 1000 - (pt->tv_nsec / 1000000);
- iTimeout += t.tv_nsec / 1000000;
- }
+ iTimeout = (pt->tv_nsec - t.tv_nsec) / 1000;
+ iTimeout += (pt->tv_sec - t.tv_sec) * 1000;
return iTimeout;
}