Add %F the ISO 8601 date format which is equivalent to %Y-%m-%d. This

format character is supported for reasons of symmetry with strftime(3).
FreeBSD and GNU versions of strptime(3) both support %F.
This commit is contained in:
ginsbach 2008-04-25 20:51:10 +00:00
parent c9cdc30221
commit b876d7a7df
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
.\" $NetBSD: strptime.3,v 1.19 2008/04/25 14:37:00 ginsbach Exp $
.\" $NetBSD: strptime.3,v 1.20 2008/04/25 20:51:10 ginsbach Exp $
.\"
.\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
.\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This file was contributed to The NetBSD Foundation by Klaus Klein.
@ -119,6 +119,9 @@ the date as %m/%d/%y.
.It Cm \&%e
the same as
.Cm \&%d .
.It Cm \&%F
the date as %Y-%m-%d
(the ISO 8601 date format).
.It Cm \&%h
the same as
.Cm \&%b .

View File

@ -1,7 +1,7 @@
/* $NetBSD: strptime.c,v 1.26 2008/04/24 21:34:48 ginsbach Exp $ */
/* $NetBSD: strptime.c,v 1.27 2008/04/25 20:51:10 ginsbach Exp $ */
/*-
* Copyright (c) 1997, 1998, 2005 The NetBSD Foundation, Inc.
* Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code was contributed to The NetBSD Foundation by Klaus Klein.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strptime.c,v 1.26 2008/04/24 21:34:48 ginsbach Exp $");
__RCSID("$NetBSD: strptime.c,v 1.27 2008/04/25 20:51:10 ginsbach Exp $");
#endif
#include "namespace.h"
@ -130,6 +130,11 @@ literal:
LEGAL_ALT(0);
goto recurse;
case 'F': /* The date as "%Y-%m-%d". */
new_fmt = "%Y-%m-%d";
LEGAL_ALT(0);
goto recurse;
case 'R': /* The time as "%H:%M". */
new_fmt = "%H:%M";
LEGAL_ALT(0);