aboutsummaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-07-27 16:23:53 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-07-27 16:23:53 +0200
commit7b716878cb6837756bd65ed788e5d8d89d8af56c (patch)
tree80839cd8fe6fdaf9bc471294821516aae462511f /src/or/geoip.c
parent2b0e8fb39f0ac9c0bfadc64102440843300fa9d7 (diff)
downloadtor-7b716878cb6837756bd65ed788e5d8d89d8af56c.tar.gz
tor-7b716878cb6837756bd65ed788e5d8d89d8af56c.zip
Fix dirreq and cell stats on 32-bit architectures.
When determining how long directory requests take or how long cells spend in queues, we were comparing timestamps on microsecond detail only to convert results to second or millisecond detail later on. But on 32-bit architectures this means that 2^31 microseconds only cover time differences of up to 36 minutes. Instead, compare timestamps on millisecond detail.
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 3336401220..5c13154205 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -739,16 +739,16 @@ geoip_get_dirreq_history(geoip_client_action_t action,
} else {
if (ent->completed) {
uint32_t *bytes_per_second = tor_malloc_zero(sizeof(uint32_t));
- uint32_t time_diff = (uint32_t) tv_udiff(&ent->request_time,
+ uint32_t time_diff = (uint32_t) tv_mdiff(&ent->request_time,
&ent->completion_time);
if (time_diff == 0)
time_diff = 1; /* Avoid DIV/0; "instant" answers are impossible
* anyway by law of nature or something.. */
- *bytes_per_second = 1000000 * ent->response_size / time_diff;
+ *bytes_per_second = 1000 * ent->response_size / time_diff;
smartlist_add(dirreq_times, bytes_per_second);
complete++;
} else {
- if (tv_udiff(&ent->request_time, &now) / 1000000 > DIRREQ_TIMEOUT)
+ if (tv_mdiff(&ent->request_time, &now) / 1000 > DIRREQ_TIMEOUT)
timeouts++;
else
running++;