aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-19 11:42:26 +0200
committerNick Mathewson <nickm@torproject.org>2016-07-19 11:42:26 +0200
commit558f7d3701ef0236e0bf2886dca538cfe1ad18bd (patch)
tree5061f1d23616afb2ccebc097262c37b083540d71 /src/or/buffers.c
parent94c27d4e8fede72b128e0bbdd8b60d77ed23ebe6 (diff)
parent1e3cf1cc8321ec29acaae6acb22340f0e2f5e9da (diff)
downloadtor-558f7d3701ef0236e0bf2886dca538cfe1ad18bd.tar.gz
tor-558f7d3701ef0236e0bf2886dca538cfe1ad18bd.zip
Merge branch 'monotonic_v2_squashed'
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)