openbsd-ports/geo/osm2go/patches/patch-src_osm_c
landry dd3e3a9277 Import osm2go 0.7.18.
OSM2Go is an Openstreetmap editor designed to run on small devices.
Current featureset includes:
 * Managing multiple mapping projects.
 * Adding, moving and deletion of ways and nodes and editing their tags.
 * JOSM-style presets for speedy tagging.
 * Import GPS traces or Live GPS trace for GPS-enabled devices
 * WMS server support: NASA satellite imagery
 * Limited relation support
 * Upload and download changes to the OSM servers!
2009-09-04 18:19:41 +00:00

38 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_osm_c,v 1.1.1.1 2009/09/04 18:19:41 landry Exp $
fix taken from gpx-viewer - to be removed once we support %F & %z
--- src/osm.c.orig Fri Jul 24 17:07:37 2009
+++ src/osm.c Wed Sep 2 22:26:45 2009
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <ctype.h>
#define __USE_XOPEN
#include <time.h>
@@ -91,15 +92,21 @@ static user_t *osm_user(osm_t *osm, char *name) {
static
time_t convert_iso8601(const char *str) {
+ char *c;
if(!str) return 0;
tzset();
+ char *s = strdup(str);
struct tm ctime;
memset(&ctime, 0, sizeof(struct tm));
- strptime(str, "%FT%T%z", &ctime);
-
- return mktime(&ctime) - timezone;
+ /* remove trailing non-digits, strptime doesn't support %z */
+ for (c = s + strlen(s); !isdigit(*c); *c='\0', c--);
+ /* now remove trailing .000 if found */
+ /* SEGV .. s[strcspn(s, ".")] = '\0'; */
+ strptime (s, "%Y-%m-%dT%T", &ctime);
+ free(s);
+ return mktime(&ctime);
}
/* -------------------- tag handling ----------------------- */