Ejemplo n.º 1
0
        protected DateTime?NextMinute(int year, int month, int day, int hour, int minute, int second)
        {
            switch (MinuteType)
            {
            case CronFieldType.Any:
                if (minute < 59)
                {
                    return(new DateTime(year, month, day, hour, minute + 1, second));
                }
                else
                {
                    return(NextHour(year, month, day, hour, 0, second));
                }

            case CronFieldType.Specified:
                var values = Minutes.Where(x => x > minute);
                if (values.Any())
                {
                    return(new DateTime(year, month, day, hour, values.First(), second));
                }
                else
                {
                    return(NextHour(year, month, day, hour, Minutes.First(), second));
                }

            default: throw new NotImplementedException();
            }
        }