GetNextOccurrence() public method

public GetNextOccurrence ( System.DateTime baseValue ) : System.DateTime
baseValue System.DateTime
return System.DateTime
示例#1
0
        public ScheduleInstant(DateTime nowInstant, TimeZoneInfo timeZone, [NotNull] CrontabSchedule schedule)
        {
            if (schedule == null) throw new ArgumentNullException("schedule");
            if (nowInstant.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("Only DateTime values in UTC should be passed.", "nowInstant");
            }

            _timeZone = timeZone;
            _schedule = schedule;

            NowInstant = nowInstant.AddSeconds(-nowInstant.Second);
            NextInstant = TimeZoneInfo.ConvertTime(
                _schedule.GetNextOccurrence(TimeZoneInfo.ConvertTime(NowInstant, TimeZoneInfo.Utc, _timeZone)),
                _timeZone,
                TimeZoneInfo.Utc);
        }