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

icaltimezone* icaltimezone_get_builtin_timezone_from_tzid ( const char *  tzid  ) 

Returns a single builtin timezone, given its TZID.

Definition at line 1480 of file icaltimezone.c.

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

    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, TZID_PREFIX, TZID_PREFIX_LEN))
      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