[Freeassociation-devel] libical: TZID prefix

Patrick Ohly patrick.ohly at gmx.de
Thu Aug 11 02:52:27 PDT 2011


Hello Allen!

I'm having some issue with the libical compiled from source which might
be related to your following commit:

commit 58333eb3d2a2001fd9f696bcb63e54ff604915c6
Author: awinterz <awinterz at b29e25b1-4845-0410-9c6e-9608a45a5811>
Date:   Sat Mar 19 20:51:06 2011 +0000

    don't put the tzid_prefixTzfile in the tzid  
    
    git-svn-id:
https://freeassociation.svn.sourceforge.net/svnroot/freeassociation/trunk@1066 b29e25b1-4845-0410-9c6e-9608a45a5811

What was the rationale for no longer putting the prefix into the TZID?

The problem is that the following program fails because
icaltimezone_get_builtin_timezone_from_tzid() fails to resolve the
"Europe/Berlin" TZID:

----------------------------------
#include <libical/ical.h>
#include <stdio.h>
#include <string>

int main(int argc, char **argv)
{
    icaltimezone *tzdef = icaltimezone_get_builtin_timezone("Europe/Berlin");
    if (tzdef) {
      std::string tzid = icaltimezone_get_tzid(tzdef);
      printf("Europe/Berlin = TZID %s\n", tzid.c_str());
      tzdef = icaltimezone_get_builtin_timezone_from_tzid(tzid.c_str());
      printf("lookup by TZID %s\n", tzdef ? "okay" : "failed");
    }
    return 0;
}
----------------------------------

The easiest fix is to revert your commit above, but if the change is
important, a different solution needs to be found.

A quick check shows that the lookup fails because it expects the TZID to
have the prefix:

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

That would have to be removed. But I'm a bit wary of other implications
of removing the TZID prefix and haven't tried that. SyncEvolution and
libsynthesis have not been tested with libical time zones without any
kind of prefix.

-- 
Bye, Patrick Ohly
--  
Patrick.Ohly at gmx.de
http://www.estamos.de/






More information about the libical-devel mailing list