4 This file is part of systemd.
6 Copyright 2010 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 typedef struct Timer Timer
;
24 #include "calendarspec.h"
26 typedef enum TimerBase
{
34 _TIMER_BASE_INVALID
= -1
37 typedef struct TimerValue
{
41 usec_t value
; /* only for monotonic events */
42 CalendarSpec
*calendar_spec
; /* only for calendar events */
45 LIST_FIELDS(struct TimerValue
, value
);
48 typedef enum TimerResult
{
50 TIMER_FAILURE_RESOURCES
,
52 _TIMER_RESULT_INVALID
= -1
61 LIST_HEAD(TimerValue
, values
);
62 usec_t next_elapse_realtime
;
63 usec_t next_elapse_monotonic_or_boottime
;
64 dual_timestamp last_trigger
;
66 TimerState state
, deserialized_state
;
68 sd_event_source
*monotonic_event_source
;
69 sd_event_source
*realtime_event_source
;
75 bool remain_after_elapse
;
80 void timer_free_values(Timer
*t
);
82 extern const UnitVTable timer_vtable
;
84 const char *timer_base_to_string(TimerBase i
) _const_
;
85 TimerBase
timer_base_from_string(const char *s
) _pure_
;
87 const char* timer_result_to_string(TimerResult i
) _const_
;
88 TimerResult
timer_result_from_string(const char *s
) _pure_
;