aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 2adb997..7125598 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -47,6 +47,10 @@ void event_add_with_timeout(struct event *ev, double timeout) {
event_add(ev, &tv);
}
+double gen_rand_timeout(double base_timeout, double alpha) {
+ return base_timeout + rand() / (double)RAND_MAX * alpha * base_timeout;
+}
+
const std::string get_current_datetime() {
/* credit: http://stackoverflow.com/a/41381479/544806 */
char fmt[64], buf[64];