]> granicus.if.org Git - icinga2/blob - lib/icinga/legacytimeperiod.hpp
Merge pull request #6727 from Icinga/feature/cluster-config-sync-stage
[icinga2] / lib / icinga / legacytimeperiod.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef LEGACYTIMEPERIOD_H
4 #define LEGACYTIMEPERIOD_H
5
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/timeperiod.hpp"
8 #include "base/dictionary.hpp"
9
10 namespace icinga
11 {
12
13 /**
14  * Implements Icinga 1.x time periods.
15  *
16  * @ingroup icinga
17  */
18 class LegacyTimePeriod
19 {
20 public:
21         static Array::Ptr ScriptFunc(const TimePeriod::Ptr& tp, double start, double end);
22
23         static bool IsInTimeRange(tm *begin, tm *end, int stride, tm *reference);
24         static void FindNthWeekday(int wday, int n, tm *reference);
25         static int WeekdayFromString(const String& daydef);
26         static int MonthFromString(const String& monthdef);
27         static void ParseTimeSpec(const String& timespec, tm *begin, tm *end, tm *reference);
28         static void ParseTimeRange(const String& timerange, tm *begin, tm *end, int *stride, tm *reference);
29         static bool IsInDayDefinition(const String& daydef, tm *reference);
30         static void ProcessTimeRangeRaw(const String& timerange, tm *reference, tm *begin, tm *end);
31         static Dictionary::Ptr ProcessTimeRange(const String& timerange, tm *reference);
32         static void ProcessTimeRanges(const String& timeranges, tm *reference, const Array::Ptr& result);
33         static Dictionary::Ptr FindNextSegment(const String& daydef, const String& timeranges, tm *reference);
34         static Dictionary::Ptr FindRunningSegment(const String& daydef, const String& timeranges, tm *reference);
35
36 private:
37         LegacyTimePeriod();
38 };
39
40 }
41
42 #endif /* LEGACYTIMEPERIOD_H */