Host C Specs


Directory: src/c/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 9 / 0 / 9
Functions: 100.0% 2 / 0 / 2
Branches: 100.0% 8 / 0 / 8

pebble/io/stores/store_poll.c
Line Branch Exec Source
1 /**
2 * @file store_poll.c
3 * @brief The polling decisions the weather, stock, and calendar stores share.
4 *
5 * Each store keeps its own interval, its own first fetch, and its own request. What they share is
6 * when a poll is due and when polling is on at all.
7 *
8 * @ingroup lib_stores
9 */
10 #include "io/stores/store_poll.h"
11
12 6 bool store_poll_set(StorePoll *poll, int poll_min, bool live, time_t now)
13 {
14 6 poll->poll_min = poll_min;
15 6 poll->live = live;
16
17
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 3 times.
6 if (!live || poll_min <= 0)
18 {
19 3 return false;
20 }
21
22 3 poll->next = store_poll_next(poll_min, now);
23 3 return true;
24 }
25
26 3 bool store_poll_turn(StorePoll *poll, time_t now)
27 {
28
4/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
3 return poll->live && store_poll_due(poll->poll_min, &poll->next, now);
29 }
30