]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/calendarspec.h
Merge pull request #33454 from YHNdnzj/user-service-working-dir-relax
[thirdparty/systemd.git] / src / shared / calendarspec.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 /* A structure for specifying (possibly repetitive) points in calendar
5 * time, a la cron */
6
7 #include <stdbool.h>
8
9 #include "time-util.h"
10
11 typedef struct CalendarComponent {
12 int start;
13 int stop;
14 int repeat;
15
16 struct CalendarComponent *next;
17 } CalendarComponent;
18
19 typedef struct CalendarSpec {
20 int weekdays_bits;
21 bool end_of_month:1;
22 bool utc:1;
23 signed int dst:2;
24 char *timezone;
25
26 CalendarComponent *year;
27 CalendarComponent *month;
28 CalendarComponent *day;
29
30 CalendarComponent *hour;
31 CalendarComponent *minute;
32 CalendarComponent *microsecond;
33 } CalendarSpec;
34
35 CalendarSpec* calendar_spec_free(CalendarSpec *c);
36
37 bool calendar_spec_valid(CalendarSpec *spec);
38
39 int calendar_spec_to_string(const CalendarSpec *spec, char **ret);
40 int calendar_spec_from_string(const char *p, CalendarSpec **ret);
41
42 int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *next);
43
44 DEFINE_TRIVIAL_CLEANUP_FUNC(CalendarSpec*, calendar_spec_free);