Forward RRULE to some date

Milan Crha mcrha at redhat.com
Wed Feb 3 10:16:58 PST 2016


On Wed, 2016-02-03 at 11:53 -0500, Ken Murchison wrote:
> struct icaltimetype 
> icalrecur_iterator_next_after_date(icalrecur_iterator *, struct 
> icaltimetype date);
> 
> which would take an existing iterator and jump forward to the first 
> instance on or after the specified date.

	Hi,
that sounds like it.

I understand the calculation of the iteration is not trivial, that's
why I called it "a high mathematics" in the previous email.

> You could mix icalrecur_iterator_next*() calls, as long as date > last 
> returned instance.

Right, that's understood. My usage of this would be very simple:
a) get some interval for which I want receive events (like a range
   of a view in UI)
b) if the DTSTART is before the interval start, then call this new
   function to get to the nearest date quickly
c) continue iteration until either the interval ends or the RRULE ends,
   whichever comes first, and remember the instances.

As the "hight mathematics" is involved, it would work to have the
function as an approximation. That is, if the calculation would be too
complicated (or the set RRULE parameters are not supported for this
forward jump), then keep the iterator where it is. My a),b),c) would
not have any issue with this approximation, especially when the
"remember the instances" in the c) would mean to re-check that the
given instance belongs to the interval, before remembering it.

	Thanks for consideration and bye,
	Milan



More information about the libical-devel mailing list