diff options
| author | ginsbach <ginsbach@NetBSD.org> | 2015-10-30 03:18:10 +0000 |
|---|---|---|
| committer | ginsbach <ginsbach@NetBSD.org> | 2015-10-30 03:18:10 +0000 |
| commit | c6b3ceb980ad68d3bc7d64c6406bfdbd2fdf8b0c (patch) | |
| tree | 79474819ff0eaca343012882a5508725efde53e0 | |
| parent | 314033f54b36b677e333e6767cdad7ba3f8351ab (diff) | |
ISO 8601 and RFC 3339 specify that an offset can be up to 23:59 and
not 12:00 east/west. Just proves that one shouldn't use other
implementations as a canonical reference. Thanks to all who pointed
this out.
| -rw-r--r-- | lib/libc/time/strptime.c | 6 | ||||
| -rw-r--r-- | tests/lib/libc/time/t_strptime.c | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/libc/time/strptime.c b/lib/libc/time/strptime.c index 9820bdcc166..5a2471bfc4b 100644 --- a/lib/libc/time/strptime.c +++ b/lib/libc/time/strptime.c @@ -1,4 +1,4 @@ -/* $NetBSD: strptime.c,v 1.52 2015/10/30 01:49:36 ginsbach Exp $ */ +/* $NetBSD: strptime.c,v 1.53 2015/10/30 03:18:10 ginsbach Exp $ */ /*- * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strptime.c,v 1.52 2015/10/30 01:49:36 ginsbach Exp $"); +__RCSID("$NetBSD: strptime.c,v 1.53 2015/10/30 03:18:10 ginsbach Exp $"); #endif #include "namespace.h" @@ -626,7 +626,7 @@ loadzone: default: return NULL; } - if (offs > (12 * SECSPERHOUR)) + if (offs >= (HOURSPERDAY * SECSPERHOUR)) return NULL; if (neg) offs = -offs; diff --git a/tests/lib/libc/time/t_strptime.c b/tests/lib/libc/time/t_strptime.c index 78a911f2667..03dc5fd8fa5 100644 --- a/tests/lib/libc/time/t_strptime.c +++ b/tests/lib/libc/time/t_strptime.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_strptime.c,v 1.8 2015/10/30 01:51:15 ginsbach Exp $ */ +/* $NetBSD: t_strptime.c,v 1.9 2015/10/30 03:18:10 ginsbach Exp $ */ /*- * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_strptime.c,v 1.8 2015/10/30 01:51:15 ginsbach Exp $"); +__RCSID("$NetBSD: t_strptime.c,v 1.9 2015/10/30 03:18:10 ginsbach Exp $"); #include <time.h> @@ -326,6 +326,10 @@ static struct { { "-0403", -14580 }, { "+04:03", 14580 }, { "-04:03", -14580 }, + { "+14:00", 50400 }, + { "-14:00", -50400 }, + { "+23:59", 86340 }, + { "-23:59", -86340 }, { "1", -1 }, { "03", -1 }, @@ -335,8 +339,8 @@ static struct { { "+12345", -1 }, { "+12:345", -1 }, { "+123:45", -1 }, - { "+1430", -1 }, - { "-1430", -1 }, + { "+2400", -1 }, + { "-2400", -1 }, { "+1060", -1 }, { "-1060", -1 }, |
