public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
To: Cygwin Patches <cygwin-patches@cygwin.com>,
	Cygwin Patches <Cygwin-Patches@Cygwin.com>
Subject: [PATCH] strptime.cc(__strptime): add %i, %q, %v
Date: Fri, 16 Sep 2022 22:55:27 -0600	[thread overview]
Message-ID: <20220917045526.5733-1-Brian.Inglis@SystematicSW.ab.ca> (raw)

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]


[Please Reply All due to email issues]

winsup/cygwin/libc/strptime.cc(__strptime):
%i year in century [00..99] Synonym for "%y". Non-POSIX extension. [tm_year]
%q GNU quarter of the year (from `<<1>>' to `<<4>>') [tm_mon]
%v OSX/Ruby VMS/Oracle date "%d-%b-%Y". Non-POSIX extension. [tm_mday, tm_mon, tm_year]
---
 winsup/cygwin/libc/strptime.cc | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-strptime.cc-__strptime-add-i-q-v.patch --]
[-- Type: text/x-patch; name="0001-strptime.cc-__strptime-add-i-q-v.patch", Size: 1270 bytes --]

diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc
index 3a9bdbb300d4..901e93607960 100644
--- a/winsup/cygwin/libc/strptime.cc
+++ b/winsup/cygwin/libc/strptime.cc
@@ -440,6 +440,12 @@ literal:
 			LEGAL_ALT(0);
 			goto recurse;
 
+		case 'v':	/* OSX/Ruby VMS/Oracle date "%d-%b-%Y". */
+			new_fmt = "%d-%b-%Y";
+			LEGAL_ALT(0);
+			ymd |= SET_YMD;
+			goto recurse;
+
 		case 'X':	/* The time, using the locale's format. */
 			new_fmt = (alt_format & ALT_E)
 				  ? _ctloc (era_t_fmt) : _ctloc(X_fmt);
@@ -570,6 +576,14 @@ literal:
 			LEGAL_ALT(0);
 			continue;
 
+		case 'q':	/* The quarter year. GNU extension. */
+			LEGAL_ALT(0);
+			i = 1;
+			bp = conv_num(bp, &i, 1, 4, ALT_DIGITS);
+			tm->tm_mon = (i - 1)*3;
+			ymd |= SET_MON;
+			continue;
+
 		case 'S':	/* The seconds. */
 			LEGAL_ALT(ALT_O);
 			bp = conv_num(bp, &tm->tm_sec, 0, 61, ALT_DIGITS);
@@ -655,7 +669,10 @@ literal:
 			got_eoff = 0;
 			continue;
 
-		case 'y':	/* The year within 100 years of the epoch. */
+		case 'i':	/* The year within 100 years of the era. */
+			LEGAL_ALT(0);
+			fallthrough;
+		case 'y':	/* The year within 100 years of the era. */
 			/* LEGAL_ALT(ALT_E | ALT_O); */
 			ymd |= SET_YEAR;
 			if ((alt_format & ALT_E) && *era_info)

                 reply	other threads:[~2022-09-17  4:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220917045526.5733-1-Brian.Inglis@SystematicSW.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).