Amend patch now that strptime supports %F and %z, but keep the part

removing 'timezone' extern which we don't seem to have.
reminded by jasper@
This commit is contained in:
landry 2011-01-19 23:26:51 +00:00
parent 85ad3659e7
commit 23bb2cd49d
2 changed files with 8 additions and 33 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.8 2011/01/11 12:40:32 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.9 2011/01/19 23:26:51 landry Exp $
COMMENT = Openstreetmap editor for handheld devices
VERSION = 0.7.22
DISTNAME = osm2go_${VERSION}-maemo1
PKGNAME = osm2go-${VERSION}
REVISION= 1
REVISION= 2
WRKDIST = ${WRKDIR}/osm2go-${VERSION}
CATEGORIES = geo x11

View File

@ -1,36 +1,11 @@
$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;
$OpenBSD: patch-src_osm_c,v 1.2 2011/01/19 23:26:51 landry Exp $
--- src/osm.c.orig Thu Jan 20 00:11:32 2011
+++ src/osm.c Thu Jan 20 00:12:53 2011
@@ -99,7 +99,7 @@ time_t convert_iso8601(const char *str) {
memset(&ctime, 0, sizeof(struct tm));
- strptime(str, "%FT%T%z", &ctime);
-
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);
}