mirror of
https://github.com/PerMalmberg/libcron.git
synced 2025-04-22 08:23:04 -05:00
#1 Build on clang.
This commit is contained in:
parent
802d8e724e
commit
e725abf87f
@ -11,7 +11,8 @@ namespace libcron
|
|||||||
class CronData
|
class CronData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::array<Months, 7> months_with_31;
|
static const int NUMBER_OF_LONG_MONTHS = 7;
|
||||||
|
static const libcron::Months months_with_31[NUMBER_OF_LONG_MONTHS];
|
||||||
|
|
||||||
static CronData create(const std::string& cron_expression);
|
static CronData create(const std::string& cron_expression);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ using namespace date;
|
|||||||
|
|
||||||
namespace libcron
|
namespace libcron
|
||||||
{
|
{
|
||||||
const constexpr std::array<Months, 7> CronData::months_with_31{ Months::January,
|
const constexpr Months CronData::months_with_31[NUMBER_OF_LONG_MONTHS] = { Months::January,
|
||||||
Months::March,
|
Months::March,
|
||||||
Months::May,
|
Months::May,
|
||||||
Months::July,
|
Months::July,
|
||||||
@ -98,7 +98,7 @@ namespace libcron
|
|||||||
{
|
{
|
||||||
res = false;
|
res = false;
|
||||||
|
|
||||||
for (size_t i = 0; !res && i < months_with_31.size(); ++i)
|
for (size_t i = 0; !res && i < NUMBER_OF_LONG_MONTHS; ++i)
|
||||||
{
|
{
|
||||||
res = months.find(months_with_31[i]) != months.end();
|
res = months.find(months_with_31[i]) != months.end();
|
||||||
}
|
}
|
||||||
|
@ -87,9 +87,9 @@ namespace libcron
|
|||||||
// Limit to 29 days, possibly causing delaying schedule until next leap year.
|
// Limit to 29 days, possibly causing delaying schedule until next leap year.
|
||||||
max = std::min(max, 29);
|
max = std::min(max, 29);
|
||||||
}
|
}
|
||||||
else if (std::find(CronData::months_with_31.begin(),
|
else if (std::find(std::begin(CronData::months_with_31),
|
||||||
CronData::months_with_31.end(),
|
std::end(CronData::months_with_31),
|
||||||
month) == CronData::months_with_31.end())
|
month) == std::end(CronData::months_with_31))
|
||||||
{
|
{
|
||||||
// Not among the months with 31 days
|
// Not among the months with 31 days
|
||||||
max = std::min(max, 30);
|
max = std::min(max, 30);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user