- remove strptime() hack, since our strptime() handles the modifiers now.
ok landry@ (MAINTAINER)
This commit is contained in:
parent
2d1c418ecb
commit
b0d6ab1adf
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.12 2010/11/17 08:05:12 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.13 2011/01/17 12:49:35 jasper Exp $
|
||||
|
||||
COMMENT = gpx file viewer
|
||||
|
||||
VERSION = 0.2.0
|
||||
DISTNAME = gpx-viewer-${VERSION}
|
||||
REVISION = 2
|
||||
REVISION = 3
|
||||
|
||||
CATEGORIES = geo x11
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
$OpenBSD: patch-src_gpx-parser_c,v 1.2 2010/09/30 07:32:54 jasper Exp $
|
||||
|
||||
Remove leading second digits, and adjust strptime() call
|
||||
ours doesn't support %z nor %F, GNU extensions
|
||||
|
||||
--- src/gpx-parser.c.orig Tue Sep 28 13:30:21 2010
|
||||
+++ src/gpx-parser.c Tue Sep 28 13:33:06 2010
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <glib-object.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
+#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -234,6 +235,7 @@ void gpx_point_set_position (GpxPoint* self, double la
|
||||
|
||||
time_t gpx_point_get_time (GpxPoint* self) {
|
||||
time_t result;
|
||||
+ char *c;
|
||||
struct tm ta = {0};
|
||||
if (self->time == NULL) {
|
||||
result = (time_t) 0;
|
||||
@@ -244,7 +246,13 @@ time_t gpx_point_get_time (GpxPoint* self) {
|
||||
return result;
|
||||
}
|
||||
memset (&ta, 0, sizeof (struct tm));
|
||||
- strptime (self->time, "%FT%T%z", &ta);
|
||||
+ /* remove trailing non-digits, strptime doesn't support %z */
|
||||
+ for (c = self->time + strlen(self->time); !isdigit(*c); *c='\0', c--);
|
||||
+ /* now remove trailing .000 if found */
|
||||
+ c = strrchr(self->time,'.');
|
||||
+ if (c != NULL);
|
||||
+ *c = '\0';
|
||||
+ strptime (self->time, "%Y-%m-%dT%T", &ta);
|
||||
self->priv->utime = mktime (&ta);
|
||||
result = self->priv->utime;
|
||||
return result;
|
Loading…
Reference in New Issue
Block a user