summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-08 15:24:21 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-19 11:40:46 +0200
commitc7558c906a1069308f8f4519b8c93245fbca9efd (patch)
treee0d22329d4f9ef7d1abb24767bf257162dc29c92 /src/or/buffers.c
parent6a2002fc091506f576934bbf50e7b8644b43bf4c (diff)
downloadtor-c7558c906a1069308f8f4519b8c93245fbca9efd.tar.gz
tor-c7558c906a1069308f8f4519b8c93245fbca9efd.zip
Use coarse monotonic timer instead of cached monotonized libevent time.
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 8b9a53c699..970d17ee41 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -405,7 +405,7 @@ static chunk_t *
buf_add_chunk_with_capacity(buf_t *buf, size_t capacity, int capped)
{
chunk_t *chunk;
- struct timeval now;
+
if (CHUNK_ALLOC_SIZE(capacity) < buf->default_chunk_size) {
chunk = chunk_new_with_alloc_size(buf->default_chunk_size);
} else if (capped && CHUNK_ALLOC_SIZE(capacity) > MAX_CHUNK_ALLOC) {
@@ -414,8 +414,7 @@ buf_add_chunk_with_capacity(buf_t *buf, size_t capacity, int capped)
chunk = chunk_new_with_alloc_size(preferred_chunk_size(capacity));
}
- tor_gettimeofday_cached_monotonic(&now);
- chunk->inserted_time = (uint32_t)tv_to_msec(&now);
+ chunk->inserted_time = (uint32_t)monotime_coarse_absolute_msec();
if (buf->tail) {
tor_assert(buf->head);
@@ -430,8 +429,8 @@ buf_add_chunk_with_capacity(buf_t *buf, size_t capacity, int capped)
}
/** Return the age of the oldest chunk in the buffer <b>buf</b>, in
- * milliseconds. Requires the current time, in truncated milliseconds since
- * the epoch, as its input <b>now</b>.
+ * milliseconds. Requires the current monotonic time, in truncated msec,
+ * as its input <b>now</b>.
*/
uint32_t
buf_get_oldest_chunk_timestamp(const buf_t *buf, uint32_t now)