-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcron_spec.h
48 lines (29 loc) · 1019 Bytes
/
cron_spec.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __CRON_CRON_SPEC_H__
#define __CRON_CRON_SPEC_H__
#include "cron.h"
#include "cron_boost.h"
namespace Cron {
class SpecParser ;
typedef unsigned long long TimeItem;
struct SpecSchedule : public ISchedule {
public:
static const TimeItem AnyMark = (1ULL<<63) ;
TimePoint Next(const TimePoint & now) const override ;
friend class SpecParser;
bool operator == (const SpecSchedule & another ) const ;
#if CRON_UNITTEST_ON
public:
#else
protected:
#endif
TimeItem m_dow; //Day of week
TimeItem m_mon; //Month
TimeItem m_dom; //Day of month
TimeItem m_hour; //Hour
TimeItem m_min; //Minuter
TimeItem m_sec; //Second
bool inline Match(int a , TimeItem b)const { return bool( (1ull <<a) & b); }
bool DayMatch(bool dom , bool dow) const ;
};
} //namespace Cron
#endif //__CRON_CRON_SPEC_H__