|
@@ -1510,83 +1510,6 @@ update_approx_time(time_t now)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
- * Fuzzy time
|
|
|
- * XXXX022 Use this consistently or rip most of it out.
|
|
|
- * ===== */
|
|
|
-
|
|
|
-
|
|
|
- * if we wanted to know "Is the current time before time X?" we could just say
|
|
|
- * "time(NULL) < X".
|
|
|
- *
|
|
|
- * But unfortunately, many users are running Tor in an imperfect world, on
|
|
|
- * even more imperfect computers. Hence, we need to track time oddly. We
|
|
|
- * model the user's computer as being "skewed" from accurate time by
|
|
|
- * -<b>ftime_skew</b> seconds, such that our best guess of the current time is
|
|
|
- * time(NULL)+ftime_skew. We also assume that our measurements of time may
|
|
|
- * have up to <b>ftime_slop</b> seconds of inaccuracy; IOW, our window of
|
|
|
- * estimate for the current time is now + ftime_skew +/- ftime_slop.
|
|
|
- */
|
|
|
-
|
|
|
- * closest to time(NULL)+ftime_skew. */
|
|
|
-static int ftime_skew = 0;
|
|
|
-
|
|
|
-static int ftime_slop = 60;
|
|
|
-
|
|
|
- * comparisons. */
|
|
|
-void
|
|
|
-ftime_set_maximum_sloppiness(int seconds)
|
|
|
-{
|
|
|
- tor_assert(seconds >= 0);
|
|
|
- ftime_slop = seconds;
|
|
|
-}
|
|
|
-
|
|
|
- * real time. */
|
|
|
-void
|
|
|
-ftime_set_estimated_skew(int seconds)
|
|
|
-{
|
|
|
- ftime_skew = seconds;
|
|
|
-}
|
|
|
-#if 0
|
|
|
-void
|
|
|
-ftime_get_window(time_t now, ftime_t *ft_out)
|
|
|
-{
|
|
|
- ft_out->earliest = now + ftime_skew - ftime_slop;
|
|
|
- ft_out->latest = now + ftime_skew + ftime_slop;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-int
|
|
|
-ftime_maybe_after(time_t now, time_t when)
|
|
|
-{
|
|
|
-
|
|
|
- return (now + ftime_skew + ftime_slop) >= when;
|
|
|
-}
|
|
|
-
|
|
|
-int
|
|
|
-ftime_maybe_before(time_t now, time_t when)
|
|
|
-{
|
|
|
-
|
|
|
- return (now + ftime_skew - ftime_slop) < when;
|
|
|
-}
|
|
|
-
|
|
|
-int
|
|
|
-ftime_definitely_after(time_t now, time_t when)
|
|
|
-{
|
|
|
-
|
|
|
- * after when. */
|
|
|
- return (now + ftime_skew - ftime_slop) >= when;
|
|
|
-}
|
|
|
-
|
|
|
- */
|
|
|
-int
|
|
|
-ftime_definitely_before(time_t now, time_t when)
|
|
|
-{
|
|
|
-
|
|
|
- * before when. */
|
|
|
- return (now + ftime_skew + ftime_slop) < when;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
* Rate limiting
|
|
|
* ===== */
|