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