]> git.ipfire.org Git - thirdparty/systemd.git/blob - timer.c
when shortcutting states do not skip state transitions
[thirdparty/systemd.git] / timer.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 #include "unit.h"
4 #include "timer.h"
5
6 static void timer_done(Unit *u) {
7 Timer *t = TIMER(u);
8
9 assert(t);
10 }
11
12 static UnitActiveState timer_active_state(Unit *u) {
13
14 static const UnitActiveState table[_TIMER_STATE_MAX] = {
15 [TIMER_DEAD] = UNIT_INACTIVE,
16 [TIMER_WAITING] = UNIT_ACTIVE,
17 [TIMER_RUNNING] = UNIT_ACTIVE
18 };
19
20 return table[TIMER(u)->state];
21 }
22
23 const UnitVTable timer_vtable = {
24 .suffix = ".timer",
25
26 .init = unit_load_fragment_and_dropin,
27 .done = timer_done,
28
29 .active_state = timer_active_state
30 };