diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-23 00:08:26 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-23 00:08:26 +0000 |
commit | cd702643770fb17c00a67f8f5154e6852acb5e1c (patch) | |
tree | 234e4dad86a8c9e60d82479dbd815187f9eaaa0b /src/common/util.c | |
parent | 6fc834ab16936530166aa087d9469048c65b1697 (diff) | |
download | tor-cd702643770fb17c00a67f8f5154e6852acb5e1c.tar tor-cd702643770fb17c00a67f8f5154e6852acb5e1c.tar.gz |
Clean up some logging and interfaces
svn:r2945
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/common/util.c b/src/common/util.c index 3099b125c..f2386cde4 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -475,7 +475,6 @@ int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen) * ===== */ /** Return the number of microseconds elapsed between *start and *end. - * If start is after end, return 0. */ long tv_udiff(struct timeval *start, struct timeval *end) @@ -483,17 +482,12 @@ tv_udiff(struct timeval *start, struct timeval *end) long udiff; long secdiff = end->tv_sec - start->tv_sec; - if (secdiff+1 > LONG_MAX/1000000) { + if (labs(secdiff+1) > LONG_MAX/1000000) { log_fn(LOG_WARN, "comparing times too far apart."); return LONG_MAX; } udiff = secdiff*1000000L + (end->tv_usec - start->tv_usec); - if(udiff < 0) { - log_fn(LOG_INFO, "start (%ld.%ld) is after end (%ld.%ld). Returning 0.", - (long)start->tv_sec, (long)start->tv_usec, (long)end->tv_sec, (long)end->tv_usec); - return 0; - } return udiff; } |