/// <summary>
        /// This is used to find the starting point for the hourly frequency
        /// </summary>
        /// <param name="r">A reference to the recurrence</param>
        /// <param name="start">The recurrence start date</param>
        /// <param name="end">The recurrence end date</param>
        /// <param name="from">The start date of the range limiting the instances generated</param>
        /// <param name="to">The end date of the range limiting the instances generated</param>
        /// <returns>The first instance date or null if there are no more instances</returns>
        public RecurDateTime FindStart(Recurrence r, RecurDateTime start, RecurDateTime end, RecurDateTime from,
                                       RecurDateTime to)
        {
            RecurDateTime rdt = new RecurDateTime(start);
            int           adjust;

            if (RecurDateTime.Compare(start, from,
                                      RecurDateTime.DateTimePart.Hour) < 0)
            {
                // Get the difference between the recurrence start and the limiting range start
                DateTime dtStart = start.ToDateTime().Date.AddHours(start.Hour),
                         dtFrom  = from.ToDateTime().Date.AddHours(from.Hour);

                // Adjust the date/time so that it's in range
                TimeSpan ts = dtFrom - dtStart;

                adjust = (int)ts.TotalHours + r.Interval - 1;
                rdt.AddHours(adjust - (adjust % r.Interval));
            }

            if (RecurDateTime.Compare(rdt, end, RecurDateTime.DateTimePart.Hour) > 0 ||
                RecurDateTime.Compare(rdt, to, RecurDateTime.DateTimePart.Hour) > 0)
            {
                return(null);
            }

            return(rdt);
        }
        /// <summary>
        /// This is used to find the next instance of the hourly frequency
        /// </summary>
        /// <param name="r">A reference to the recurrence</param>
        /// <param name="end">The recurrence end date</param>
        /// <param name="to">The end date of the range limiting the instances generated</param>
        /// <param name="last">This is used to pass in the last instance date calculated and return the next
        /// instance date</param>
        /// <returns>True if the recurrence has another instance or false if there are no more instances</returns>
        public bool FindNext(Recurrence r, RecurDateTime end, RecurDateTime to, RecurDateTime last)
        {
            last.AddHours(r.Interval);

            if (RecurDateTime.Compare(last, end, RecurDateTime.DateTimePart.Hour) > 0 ||
                RecurDateTime.Compare(last, to, RecurDateTime.DateTimePart.Hour) > 0)
            {
                return(false);
            }

            return(true);
        }