Forward RRULE to some date
Ken Murchison
murch at andrew.cmu.edu
Wed Feb 3 08:53:52 PST 2016
Hi Milan,
On 02/03/2016 11:24 AM, Milan Crha wrote:
> Hi,
> while I'm playing with RSCALE support for the evolution-data-server
> calendar I realized that the current implementation
> of icalrecur_iterator() doesn't allow Forward to some date.
>
> What I mean with that?
>
> Consider that you've a recurring meeting which begun in year 2000 and
> it's repeated every week. If I ask for its instances for this year,
> then it means that I need to start at DTSTART of the event (to get
> correct times) and move through all those 16 years until I get to the
> year 2016. That is, roughly, 848 (=16*53) calls
> of icalrecur_iterator_next().
>
> There might be a way to not count it iteratively.
>
> I know it's a high mathematics. The above example is oversimplified
> (especially when you consider the RSCALE), but it would be a nice
> performance improvement if one would be able to give some function a
> DTSTART, an RRULE and a DATE and the function would return the nearest
> start date since the DATE, which is in the RRULE generation chain,
> without iterating with icalrecur_iterator_next().
>
> What do you think?
This is probably doable for FREQ=YEARLY because of the way that libical
generates those instances. And maybe even for MONTHLY. I'd have to
think about whether its possible for the other RRULE frequencies.
If we were to add something like this, I'm thinkng we'd add a function
something like:
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.
You could mix icalrecur_iterator_next*() calls, as long as date > last
returned instance.
--
Kenneth Murchison
Principal Systems Software Engineeer
Carnegie Mellon University
More information about the libical-devel
mailing list