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

struct icaltime_span icaltime_span_new ( struct icaltimetype  dtstart,
struct icaltimetype  dtend,
int  is_busy 
) [read]

calculate an icaltimespan given a start and end time.

calculate an icaltimespan given a start and end time.

dtstart The beginning time of the span, can be a date-time or just a date.
dtend The end time of the span.
is_busy A boolean value, 0/1.
A span using the supplied values.
returned span contains times specified in UTC.

Definition at line 1105 of file icaltime.c.

References icaltime_span::end, icaltimezone_get_utc_timezone(), icaltime_span::is_busy, and icaltime_span::start.

  icaltime_span span;

  span.is_busy = is_busy;

  span.start   = icaltime_as_timet_with_zone(dtstart,
            dtstart.zone ? dtstart.zone : icaltimezone_get_utc_timezone());

  if (icaltime_is_null_time(dtend)) {
    if (!icaltime_is_date(dtstart)) {
      /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION
       it takes no time */
      span.end = span.start;
      return span;
    } else {
      dtend = dtstart;

  span.end = icaltime_as_timet_with_zone(dtend, 
            dtend.zone ? dtend.zone : icaltimezone_get_utc_timezone());
  if (icaltime_is_date(dtstart)) {
    /* no time specified, go until the end of the day..*/
    span.end += 60*60*24 - 1;
  return span;

Generated by  Doxygen 1.6.0   Back to index