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); }
public ScheduleInstantFacts() { _now = new DateTime(2012, 12, 12, 12, 12, 0, DateTimeKind.Utc); _schedule = CrontabSchedule.Parse("* * * * *"); _timeZone = TimeZoneInfo.Utc; }