]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
36697dc0 LP |
2 | #pragma once |
3 | ||
36697dc0 LP |
4 | /* A structure for specifying (possibly repetitive) points in calendar |
5 | * time, a la cron */ | |
6 | ||
7 | #include <stdbool.h> | |
71d35b6b | 8 | |
11c3a366 | 9 | #include "time-util.h" |
36697dc0 LP |
10 | |
11 | typedef struct CalendarComponent { | |
e78fce48 DC |
12 | int start; |
13 | int stop; | |
36697dc0 LP |
14 | int repeat; |
15 | ||
16 | struct CalendarComponent *next; | |
17 | } CalendarComponent; | |
18 | ||
19 | typedef struct CalendarSpec { | |
20 | int weekdays_bits; | |
80b19994 LP |
21 | bool end_of_month:1; |
22 | bool utc:1; | |
23 | signed int dst:2; | |
48d26c01 | 24 | char *timezone; |
36697dc0 LP |
25 | |
26 | CalendarComponent *year; | |
27 | CalendarComponent *month; | |
28 | CalendarComponent *day; | |
29 | ||
30 | CalendarComponent *hour; | |
31 | CalendarComponent *minute; | |
436dd70f | 32 | CalendarComponent *microsecond; |
36697dc0 LP |
33 | } CalendarSpec; |
34 | ||
7c123d49 | 35 | CalendarSpec* calendar_spec_free(CalendarSpec *c); |
36697dc0 | 36 | |
36697dc0 LP |
37 | bool calendar_spec_valid(CalendarSpec *spec); |
38 | ||
24b0c6c2 YW |
39 | int calendar_spec_to_string(const CalendarSpec *spec, char **ret); |
40 | int calendar_spec_from_string(const char *p, CalendarSpec **ret); | |
36697dc0 LP |
41 | |
42 | int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *next); | |
6d86f4bd LP |
43 | |
44 | DEFINE_TRIVIAL_CLEANUP_FUNC(CalendarSpec*, calendar_spec_free); |