Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time Add 'J' (Juliett) as military time zone name m...
details: https://anonhg.NetBSD.org/src/rev/7d21a15db1b6
branches: trunk
changeset: 341321:7d21a15db1b6
user: ginsbach <ginsbach%NetBSD.org@localhost>
date: Fri Oct 30 21:36:25 2015 +0000
description:
Add 'J' (Juliett) as military time zone name meaning the local time zone.
diffstat:
lib/libc/time/strptime.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diffs (58 lines):
diff -r 5f822ab7c1e8 -r 7d21a15db1b6 lib/libc/time/strptime.c
--- a/lib/libc/time/strptime.c Fri Oct 30 21:18:16 2015 +0000
+++ b/lib/libc/time/strptime.c Fri Oct 30 21:36:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strptime.c,v 1.55 2015/10/30 18:20:16 christos Exp $ */
+/* $NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 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.55 2015/10/30 18:20:16 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 ginsbach Exp $");
#endif
#include "namespace.h"
@@ -492,9 +492,11 @@
* C[DS]T = Central : -5 | -6
* M[DS]T = Mountain: -6 | -7
* P[DS]T = Pacific : -7 | -8
- * Military
+ * Nautical/Military
* [A-IL-M] = -1 ... -9 (J not used)
* [N-Y] = +1 ... +12
+ * Note: J maybe used to denote non-nautical
+ * local time
*/
while (isspace(*bp))
bp++;
@@ -532,7 +534,7 @@
namedzone:
bp = zname;
- /* Military style */
+ /* Nautical / Military style */
if (delim(bp[1]) &&
((*bp >= 'A' && *bp <= 'I') ||
(*bp >= 'L' && *bp <= 'Y'))) {
@@ -553,6 +555,17 @@
bp++;
continue;
}
+ /* 'J' is local time */
+ if (delim(bp[1]) && *bp == 'J') {
+#ifdef TM_GMTOFF
+ tm->TM_GMTOFF = -timezone;
+#endif
+#ifdef TM_ZONE
+ tm->TM_ZONE = tzname[i];
+#endif
+ bp++;
+ continue;
+ }
/*
* From our 3 letter hard-coded table
Home |
Main Index |
Thread Index |
Old Index