Logo Search packages:      
Sourcecode: libical version File versions

void icaltimezone_convert_time ( struct icaltimetype *  tt,
icaltimezone *  from_zone,
icaltimezone *  to_zone 

Converting times between timezones.

Definition at line 777 of file icaltimezone.c.

References icaltimezone_get_utc_offset(), and icaltimezone_get_utc_offset_of_utc_time().

Referenced by icaltime_as_timet_with_zone(), icaltime_convert_to_zone(), and icaltime_from_timet_with_zone().

    int utc_offset, is_daylight;

    /* If the time is a DATE value or both timezones are the same, or we are
       converting a floating time, we don't need to do anything. */
    if (icaltime_is_date(*tt) || from_zone == to_zone || from_zone == NULL)

    /* Convert the time to UTC by getting the UTC offset and subtracting it. */
    utc_offset = icaltimezone_get_utc_offset (from_zone, tt, NULL);
    icaltime_adjust (tt, 0, 0, 0, -utc_offset);

    /* Now we convert the time to the new timezone by getting the UTC offset
       of our UTC time and adding it. */       
    utc_offset = icaltimezone_get_utc_offset_of_utc_time (to_zone, tt,
    tt->is_daylight = is_daylight;
    icaltime_adjust (tt, 0, 0, 0, utc_offset);

Generated by  Doxygen 1.6.0   Back to index