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

time_t icaltime_as_timet_with_zone ( const struct icaltimetype  _tt,
const icaltimezone *  zone 
)

Return the time as seconds past the UNIX epoch, using the given timezone.

Return the time as seconds past the UNIX epoch, using timezones.

This convenience method combines a call to icaltime_convert() with a call to icaltime_as_timet(). If the input timezone is null, no conversion is done; that is, the time is simply returned as time_t in its native timezone.

Definition at line 276 of file icaltime.c.

{
    struct icaltimetype tt = _tt;
    struct tm stm;
    time_t t;

    /* If the time is the special null time, return 0. */
    if (icaltime_is_null_time(tt)) {
      return 0;
    }

    if (zone != NULL) {
      tt = icaltime_convert_to_zone(_tt, zone);
    }

    /* Copy the icaltimetype to a struct tm. */
    memset (&stm, 0, sizeof (struct tm));

    stm.tm_sec = tt.second;
    stm.tm_min = tt.minute;
    stm.tm_hour = tt.hour;
    stm.tm_mday = tt.day;
    stm.tm_mon = tt.month-1;
    stm.tm_year = tt.year-1900;
    stm.tm_isdst = -1;

    t = make_time(&stm, 0);

    return t;
}


Generated by  Doxygen 1.6.0   Back to index