1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #ifndef LEGACYTIMEPERIOD_H
4 #define LEGACYTIMEPERIOD_H
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/timeperiod.hpp"
8 #include "base/dictionary.hpp"
14 * Implements Icinga 1.x time periods.
18 class LegacyTimePeriod
21 static Array::Ptr ScriptFunc(const TimePeriod::Ptr& tp, double start, double end);
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);
42 #endif /* LEGACYTIMEPERIOD_H */