From: <svn...@op...> - 2010-08-14 00:12:36
|
Author: cdfrey Date: Sat Aug 14 02:12:27 2010 New Revision: 6090 URL: http://www.opensync.org/changeset/6090 Log: Do not strip out the dashes related to timezone offsets With a string such as "2010-05-01T03:15:00.000-03:00", the previous version of the function would remove the dash from the "-03:00" timezone offset. This is not correct. Modified: trunk/opensync/format/opensync_time.c Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sat Aug 14 01:00:51 2010 (r6089) +++ trunk/opensync/format/opensync_time.c Sat Aug 14 02:12:27 2010 (r6090) @@ -71,13 +71,16 @@ static char *osync_time_timestamp_remove_dash(const char *timestamp) { - int i, len; + int i, len, date; GString *str = g_string_new(""); len = strlen(timestamp); - for (i=0; i < len; i++) { - if (timestamp[i] == '-') + for (i=0, date=1; i < len; i++) { + if (timestamp[i] == 'T') + date = 0; + + if (date && timestamp[i] == '-') continue; if (timestamp[i] == ':') |