public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] strptime.cc(__strptime): add %q GNU quarter
@ 2022-10-22  5:16 Brian Inglis
  2022-10-24 12:09 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Inglis @ 2022-10-22  5:16 UTC (permalink / raw)
  To: cygwin-patches

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

---
 winsup/cygwin/libc/strptime.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)


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

diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc
index 3a9bdbb300d4..d1e635cd279f 100644
--- a/winsup/cygwin/libc/strptime.cc
+++ b/winsup/cygwin/libc/strptime.cc
@@ -570,6 +570,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 +663,7 @@ literal:
 			got_eoff = 0;
 			continue;
 
-		case 'y':	/* The year within 100 years of the epoch. */
+		case 'y':	/* The year within 100 years of the century or era. */
 			/* LEGAL_ALT(ALT_E | ALT_O); */
 			ymd |= SET_YEAR;
 			if ((alt_format & ALT_E) && *era_info)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] strptime.cc(__strptime): add %q GNU quarter
  2022-10-22  5:16 [PATCH] strptime.cc(__strptime): add %q GNU quarter Brian Inglis
@ 2022-10-24 12:09 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2022-10-24 12:09 UTC (permalink / raw)
  To: cygwin-patches

On Oct 21 23:16, Brian Inglis wrote:
> ---
>  winsup/cygwin/libc/strptime.cc | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 

> diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc
> index 3a9bdbb300d4..d1e635cd279f 100644
> --- a/winsup/cygwin/libc/strptime.cc
> +++ b/winsup/cygwin/libc/strptime.cc
> @@ -570,6 +570,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 +663,7 @@ literal:
>  			got_eoff = 0;
>  			continue;
>  
> -		case 'y':	/* The year within 100 years of the epoch. */
> +		case 'y':	/* The year within 100 years of the century or era. */
>  			/* LEGAL_ALT(ALT_E | ALT_O); */
>  			ymd |= SET_YEAR;
>  			if ((alt_format & ALT_E) && *era_info)

Pushed.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-24 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22  5:16 [PATCH] strptime.cc(__strptime): add %q GNU quarter Brian Inglis
2022-10-24 12:09 ` Corinna Vinschen

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).