From: <svn...@op...> - 2010-07-09 19:16:07
|
Author: cdfrey Date: Fri Jul 9 21:15:55 2010 New Revision: 6053 URL: http://www.opensync.org/changeset/6053 Log: Compile workaround for _XOPEN_SOURCE header funkiness: strptime() Added: plugins/google-calendar/src/timestamp.c plugins/google-calendar/src/timestamp.h Modified: plugins/google-calendar/src/CMakeLists.txt plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/CMakeLists.txt ============================================================================== --- plugins/google-calendar/src/CMakeLists.txt Mon Jul 5 20:53:52 2010 (r6052) +++ plugins/google-calendar/src/CMakeLists.txt Fri Jul 9 21:15:55 2010 (r6053) @@ -2,7 +2,7 @@ LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ${LIBGCAL_LIBRARY_DIRS} ) INCLUDE_DIRECTORIES( ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ${LIBGCAL_INCLUDE_DIRS} ) -OPENSYNC_PLUGIN_ADD( gcalendar gcalendar.c ) +OPENSYNC_PLUGIN_ADD( gcalendar gcalendar.c timestamp.c ) OPENSYNC_FORMAT_ADD( gdata-format gdata_format.c ) TARGET_LINK_LIBRARIES( gcalendar ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${LIBGCAL_LIBRARIES}) Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Mon Jul 5 20:53:52 2010 (r6052) +++ plugins/google-calendar/src/gcalendar.c Fri Jul 9 21:15:55 2010 (r6053) @@ -26,10 +26,6 @@ * */ -#define _XOPEN_SOURCE /* man page say: glibc2 needs this */ -#include <time.h> -#include <sys/time.h> - #include <opensync/opensync.h> #include <opensync/opensync-plugin.h> #include <opensync/opensync-helper.h> @@ -54,6 +50,10 @@ #include <gcontact.h> #include "xslt_aux.h" +#include "timestamp.h" +#include <time.h> +#include <sys/time.h> + static int timestamp_cmp(char *timestamp1, char *timestamp2) { /* timestamp (RFC3339) formating string */ @@ -66,8 +66,8 @@ return 1; /* From timestamp string to time structure */ - strptime(timestamp1, format, &first); - strptime(timestamp2, format, &second); + timestamp2tm(timestamp1, format, &first); + timestamp2tm(timestamp2, format, &second); /* From time structure to calendar time (since * Epoch (00:00:00 UTC, January 1, 1970) Added: plugins/google-calendar/src/timestamp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/google-calendar/src/timestamp.c Fri Jul 9 21:15:55 2010 (r6053) @@ -0,0 +1,9 @@ +#define _XOPEN_SOURCE /* man page say: glibc2 needs this */ +#include <time.h> +#include <sys/time.h> + +char *timestamp2tm(const char *s, const char *format, struct tm *tm) +{ + return strptime(s, format, tm); +} + Added: plugins/google-calendar/src/timestamp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/google-calendar/src/timestamp.h Fri Jul 9 21:15:55 2010 (r6053) @@ -0,0 +1,8 @@ +#ifndef __GCAL_TIMESTAMP_H__ +#define __GCAL_TIMESTAMP_H__ + +struct tm; +char *timestamp2tm(const char *s, const char *format, struct tm *tm); + +#endif + |