Logo Search packages:      
Sourcecode: libical version File versions  Download package

int icalrecur_expand_recurrence ( char *  rule,
time_t  start,
int  count,
time_t *  array 
)

Fills array up with at most 'count' time_t values, each representing an occurrence time in seconds past the POSIX epoch

Fill an array with the 'count' number of occurrences generated by the rrule. Note that the times are returned in UTC, but the times are calculated in local time. YOu will have to convert the results back into local time before using them.

Definition at line 2428 of file icalrecur.c.

References icalrecur_iterator_free(), icalrecur_iterator_new(), icalrecur_iterator_next(), and icalrecurrencetype_from_string().

{
    struct icalrecurrencetype recur;
    icalrecur_iterator* ritr;
    time_t tt;
    struct icaltimetype icstart, next;
    int i = 0;

    memset(array, 0, count*sizeof(time_t));

    icstart = icaltime_from_timet_with_zone(start,0,0);

    recur = icalrecurrencetype_from_string(rule);

    for(ritr = icalrecur_iterator_new(recur,icstart),
      next = icalrecur_iterator_next(ritr);
      !icaltime_is_null_time(next) && i < count;
      next = icalrecur_iterator_next(ritr)){

      tt = icaltime_as_timet(next);
      
      if (tt >= start ){
          array[i++] = tt;
      }

    }

    icalrecur_iterator_free(ritr);

    return 1;
}


Generated by  Doxygen 1.6.0   Back to index