Loading...
Searching...
No Matches
hour_latch.h
Go to the documentation of this file.
1
12#pragma once
13#include <stdbool.h>
14#include <time.h>
15
20
24typedef struct
25{
26 time_t last_start;
27} HourLatch;
28
29#define HOUR_LATCH_EMPTY {.last_start = -1}
30
43time_t hour_latch_start(time_t now, int tm_min, int tm_sec);
44
53bool hour_latch_take(HourLatch *latch, int tick_min, time_t start);
54
61void hour_latch_seed(HourLatch *latch, time_t start);
62
void hour_latch_seed(HourLatch *latch, time_t start)
Marks an hour as buzzed without buzzing it.
Definition hour_latch.c:25
time_t hour_latch_start(time_t now, int tm_min, int tm_sec)
When the local hour holding a moment began, as seconds since the epoch.
Definition hour_latch.c:9
bool hour_latch_take(HourLatch *latch, int tick_min, time_t start)
Whether a tick should buzz the hour, and if so, marks the hour as buzzed.
Definition hour_latch.c:14
Remembers the hour that last buzzed.
Definition hour_latch.h:25
time_t last_start
when the hour that last buzzed began, or -1 before any has
Definition hour_latch.h:26