Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src ISO 8601 and RFC 3339 specify that an offset can be up to 23...



details:   https://anonhg.NetBSD.org/src/rev/a14dfeeb98d0
branches:  trunk
changeset: 341299:a14dfeeb98d0
user:      ginsbach <ginsbach%NetBSD.org@localhost>
date:      Fri Oct 30 03:18:10 2015 +0000

description:
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.

diffstat:

 lib/libc/time/strptime.c         |   6 +++---
 tests/lib/libc/time/t_strptime.c |  12 ++++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r 06c05853cee8 -r a14dfeeb98d0 lib/libc/time/strptime.c
--- a/lib/libc/time/strptime.c  Fri Oct 30 03:08:56 2015 +0000
+++ b/lib/libc/time/strptime.c  Fri Oct 30 03:18:10 2015 +0000
@@ -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 @@
                        default:
                                return NULL;
                        }
-                       if (offs > (12 * SECSPERHOUR))
+                       if (offs >= (HOURSPERDAY * SECSPERHOUR))
                                return NULL;
                        if (neg)
                                offs = -offs;
diff -r 06c05853cee8 -r a14dfeeb98d0 tests/lib/libc/time/t_strptime.c
--- a/tests/lib/libc/time/t_strptime.c  Fri Oct 30 03:08:56 2015 +0000
+++ b/tests/lib/libc/time/t_strptime.c  Fri Oct 30 03:18:10 2015 +0000
@@ -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 @@
        { "-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 @@
        { "+12345",                     -1 },
        { "+12:345",                    -1 },
        { "+123:45",                    -1 },
-       { "+1430",                      -1 },
-       { "-1430",                      -1 },
+       { "+2400",                      -1 },
+       { "-2400",                      -1 },
        { "+1060",                      -1 },
        { "-1060",                      -1 },
 



Home | Main Index | Thread Index | Old Index