Logo Search packages:      
Sourcecode: libical version File versions

icaltimezone* icaltimezone_get_builtin_timezone_from_tzid ( const char *  tzid  ) 

Returns a single builtin timezone, given its TZID.

Definition at line 1479 of file icaltimezone.c.

References ical_tzid_prefix, icaltimezone_get_builtin_timezone(), and icaltimezone_get_tzid().

    int num_slashes = 0;
    const char *p, *zone_tzid;
    icaltimezone *zone;

    if (!tzid || !tzid[0])
      return NULL;

    /* Check that the TZID starts with our unique prefix. */
    if (strncmp (tzid, ical_tzid_prefix, strlen(ical_tzid_prefix)))
      return NULL;

    /* Get the location, which is after the 3rd '/' character. */
    p = tzid;
    for (p = tzid; *p; p++) {
      if (*p == '/') {
          if (num_slashes == 3)

    if (num_slashes != 3)
      return NULL;


    /* Now we can use the function to get the builtin timezone from the
       location string. */
    zone = icaltimezone_get_builtin_timezone (p);
    if (!zone)
      return NULL;

    /* Check that the builtin TZID matches exactly. We don't want to return
       a different version of the VTIMEZONE. */
    zone_tzid = icaltimezone_get_tzid (zone);
    if (!strcmp (zone_tzid, tzid))
      return zone;
      return NULL;

Generated by  Doxygen 1.6.0   Back to index