Module Name: src Committed By: ginsbach Date: Fri Oct 30 03:18:10 UTC 2015
Modified Files: src/lib/libc/time: strptime.c src/tests/lib/libc/time: t_strptime.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/lib/libc/time/strptime.c cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/time/t_strptime.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/time/strptime.c diff -u src/lib/libc/time/strptime.c:1.52 src/lib/libc/time/strptime.c:1.53 --- src/lib/libc/time/strptime.c:1.52 Fri Oct 30 01:49:36 2015 +++ src/lib/libc/time/strptime.c Fri Oct 30 03:18:10 2015 @@ -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; Index: src/tests/lib/libc/time/t_strptime.c diff -u src/tests/lib/libc/time/t_strptime.c:1.8 src/tests/lib/libc/time/t_strptime.c:1.9 --- src/tests/lib/libc/time/t_strptime.c:1.8 Fri Oct 30 01:51:15 2015 +++ src/tests/lib/libc/time/t_strptime.c Fri Oct 30 03:18:10 2015 @@ -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 },