diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-27 14:45:17 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-27 14:45:17 +0000 |
commit | ea7fd874d7b294dacc909a0f8e9c51dcc639d879 (patch) | |
tree | cca6362933bc734907e5c6f99360eafe2d5c738f | |
parent | cd6501b3417262a4377b3944d386f72a26c82864 (diff) | |
download | rsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.tar.gz rsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.tar.xz rsyslog-ea7fd874d7b294dacc909a0f8e9c51dcc639d879.zip |
fixed a cosmetic issue in timeoutValue calculation (just used for
displaying)
-rwxr-xr-x | srUtils.c | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -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; } |