Logo Search packages:      
Sourcecode: libical version File versions

time_t icaltime_as_timet ( const struct icaltimetype  tt  ) 

Return the time as seconds past the UNIX epoch.

Return the time as seconds past the UNIX epoch

While this function is not currently deprecated, it probably won't do what you expect, unless you know what you're doing. In particular, you should only pass an icaltime in UTC, since no conversion is done. Even in that case, it's probably better to just use icaltime_as_timet_with_zone().

Definition at line 264 of file icaltime.c.

    struct tm stm;
    time_t t;

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

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

    if (icaltime_is_date(tt)) {
      stm.tm_sec = stm.tm_min = stm.tm_hour = 0;
    } else {
      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