Commit 15c74e6c authored by Ali Raheem's avatar Ali Raheem
Browse files

include math

parent 8a1d188f
Pipeline #2256 failed with stage
in 40 minutes and 51 seconds
......@@ -28,6 +28,7 @@ hibernating, phase 2:
*/
#define HIBERNATE_PRIVATE
#include <math.h>
#include "core/or/or.h"
#include "core/or/channel.h"
#include "core/or/channeltls.h"
......@@ -664,10 +665,10 @@ accounting_set_wakeup_time(void)
/* This is not a perfectly unbiased conversion, but it is good enough:
* in the worst case, the first half of the day is 0.06 percent likelier
* to be chosen than the last half. */
int branch = digest & 1;
int branch = get_uint32(digest) & 1;
double t = (get_uint32(digest) % (int) exp(time_to_consider/2));
t = log(t);
if branch t = -t;
if (branch == 1) t = -t;
interval_wakeup_time = interval_start_time + (int) t;
// interval_wakeup_time = interval_start_time +
// (get_uint32(digest) % time_to_consider);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment