1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 29fe4a4..73fb211 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -381,7 +381,8 @@ void thread(void)
 {
     bool exit = false;
     char *exit_reason = "unknown";
-    long sleep_time = 60 * HZ;
+    long sleep_step = 60 * HZ;
+    long next_wake = *rb->current_tick;
     struct queue_event ev;
     int fd;

@@ -415,7 +416,8 @@ void thread(void)
         }

         /* sleep some time until next measurement */
-        rb->queue_wait_w_tmo(&thread_q, &ev, sleep_time);
+        next_wake += sleep_step;
+        rb->queue_wait_w_tmo(&thread_q, &ev, next_wake - *rb->current_tick);
         switch (ev.id)
         {
             case SYS_USB_CONNECTED: