aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-21 17:33:49 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-22 09:49:13 -0400
commit9426751b72e922b5ee2b00bcc6158f5651a81014 (patch)
tree08b063dca1b75c7239ed62554b0cc851ea6b026e /src/common/util.c
parentd1cada5a8a7e1631e25f5f413c66d5c9e5113e7a (diff)
downloadtor-9426751b72e922b5ee2b00bcc6158f5651a81014.tar.gz
tor-9426751b72e922b5ee2b00bcc6158f5651a81014.zip
Extract our code for answering "what time is it right now".
The other time stuff is higher-level
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 877368af59..358a68fd75 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1799,37 +1799,6 @@ format_time_interval(char *out, size_t out_len, long interval)
}
/* =====
- * Cached time
- * ===== */
-
-#ifndef TIME_IS_FAST
-/** Cached estimate of the current time. Updated around once per second;
- * may be a few seconds off if we are really busy. This is a hack to avoid
- * calling time(NULL) (which not everybody has optimized) on critical paths.
- */
-static time_t cached_approx_time = 0;
-
-/** Return a cached estimate of the current time from when
- * update_approx_time() was last called. This is a hack to avoid calling
- * time(NULL) on critical paths: please do not even think of calling it
- * anywhere else. */
-time_t
-approx_time(void)
-{
- return cached_approx_time;
-}
-
-/** Update the cached estimate of the current time. This function SHOULD be
- * called once per second, and MUST be called before the first call to
- * get_approx_time. */
-void
-update_approx_time(time_t now)
-{
- cached_approx_time = now;
-}
-#endif /* !defined(TIME_IS_FAST) */
-
-/* =====
* Rate limiting
* ===== */