]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/calendarspec.h
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.git] / src / basic / calendarspec.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
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#include "util.h"
11
12typedef struct CalendarComponent {
e78fce48
DC
13 int start;
14 int stop;
36697dc0
LP
15 int repeat;
16
17 struct CalendarComponent *next;
18} CalendarComponent;
19
20typedef struct CalendarSpec {
21 int weekdays_bits;
8ea80351 22 bool end_of_month;
51ffa239 23 bool utc;
21b3a0fc 24 int dst;
48d26c01 25 char *timezone;
36697dc0
LP
26
27 CalendarComponent *year;
28 CalendarComponent *month;
29 CalendarComponent *day;
30
31 CalendarComponent *hour;
32 CalendarComponent *minute;
436dd70f 33 CalendarComponent *microsecond;
36697dc0
LP
34} CalendarSpec;
35
7c123d49 36CalendarSpec* calendar_spec_free(CalendarSpec *c);
36697dc0
LP
37
38int calendar_spec_normalize(CalendarSpec *spec);
39bool calendar_spec_valid(CalendarSpec *spec);
40
41int calendar_spec_to_string(const CalendarSpec *spec, char **p);
42int calendar_spec_from_string(const char *p, CalendarSpec **spec);
43
44int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *next);
6d86f4bd
LP
45
46DEFINE_TRIVIAL_CLEANUP_FUNC(CalendarSpec*, calendar_spec_free);