public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs
@ 2022-09-14  2:52 Brian Inglis
  2022-09-14  2:52 ` [PATCH 1/3] strftime.c(__strftime): " Brian Inglis
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Brian Inglis @ 2022-09-14  2:52 UTC (permalink / raw)
  To: Cygwin Patches, Cygwin Patches; +Cc: Brian Inglis

[Please Reply All due to email issues]

newlib/libc/time/strftime.c(strftime): add %i, %q, %v, tests; tweak %Z docs
newlib/libc/time/strptime.c(strptime_l): add %i, %q, %v
winsup/cygwin/libc/strptime.cc(__strptime): add %i, %q, %v

%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]
add %i %q %v tests
%Z clarify current time zone *abbreviation* not "name" [tm_isdst]

Brian Inglis (3):
  strftime.c(__strftime): add %i, %q, %v, tests; tweak %Z docs
  strptime.c(strptime_l): add %i, %q, %v
  strptime.cc(__strptime): add %i, %q, %v

 newlib/libc/time/strftime.c    | 67 ++++++++++++++++++++++++++++++++--
 newlib/libc/time/strptime.c    | 18 ++++++++-
 winsup/cygwin/libc/strptime.cc | 19 +++++++++-
 3 files changed, 99 insertions(+), 5 deletions(-)

-- 
2.37.2


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

* [PATCH 1/3] strftime.c(__strftime): add %i, %q, %v, tests; tweak %Z docs
  2022-09-14  2:52 [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Brian Inglis
@ 2022-09-14  2:52 ` Brian Inglis
  2022-09-14  2:52 ` [PATCH 2/3] strptime.c(strptime_l): add %i, %q, %v Brian Inglis
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2022-09-14  2:52 UTC (permalink / raw)
  To: Cygwin Patches, Cygwin Patches; +Cc: Brian Inglis

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


newlib/libc/time/strftime.c(__strftime):
%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]
%Z clarify current time zone *abbreviation* not "name" [tm_isdst]
---
 newlib/libc/time/strftime.c | 67 +++++++++++++++++++++++++++++++++++--
 1 file changed, 64 insertions(+), 3 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-strftime.c-__strftime-add-i-q-v-tests-tweak-Z-docs.patch --]
[-- Type: text/x-patch; name="0001-strftime.c-__strftime-add-i-q-v-tests-tweak-Z-docs.patch", Size: 7077 bytes --]

diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 9c884dca9766..d434c0d0233c 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -128,6 +128,9 @@ o %I
 The hour (on a 12-hour clock), formatted with two digits (from
 `<<01>>' to `<<12>>'). [tm_hour]
 
+o %i
+Synonym for "%y". Non-POSIX extension. [tm_year]
+
 o %j
 The count of days in the year, formatted with three digits
 (from `<<001>>' to `<<366>>'). [tm_yday]
@@ -161,6 +164,10 @@ the current locale. [tm_hour]
 o %P
 Same as '<<%p>>', but in lowercase.  This is a GNU extension. [tm_hour]
 
+o %q
+Quarter of the year (from `<<1>>' to `<<4>>'), with January starting
+the first quarter. This is a GNU extension. [tm_mon]
+
 o %r
 Replaced by the time in a.m. and p.m. notation.  In the "C" locale this
 is equivalent to "%I:%M:%S %p".  In locales which don't define a.m./p.m.
@@ -198,6 +205,10 @@ The week number, where weeks start on Monday, week 1 contains January 4th,
 and earlier days are in the previous year.  Formatted with two digits
 (from `<<01>>' to `<<53>>').  See also <<%G>>. [tm_year, tm_wday, tm_yday]
 
+o %v
+A string representing the OSX/Ruby VMS/Oracle date format, in the form
+`<<"%d-%b-%Y">>'. Non-POSIX extension. [tm_mday, tm_mon, tm_year]
+
 o %w
 The weekday as a number, 0-based from Sunday (from `<<0>>' to `<<6>>').
 [tm_wday]
@@ -235,9 +246,9 @@ savings offset for the current timezone. The offset is determined from
 the TZ environment variable, as if by calling tzset(). [tm_isdst]
 
 o %Z
-The time zone name.  If tm_isdst is negative, no output is generated.
-Otherwise, the time zone name is based on the TZ environment variable,
-as if by calling tzset(). [tm_isdst]
+The current time zone abbreviation. If tm_isdst is negative, no output
+is generated. Otherwise, the time zone abbreviation is based on the TZ
+environment variable, as if by calling tzset(). [tm_isdst]
 
 o %%
 A single character, `<<%>>'.
@@ -1086,6 +1097,11 @@ recurse:
 		return 0;
 	    }
 	  break;
+	case CQ('q'):	/* GNU quarter year */
+	  len = snprintf (&s[count], maxsize - count, CQ("%.1d"),
+			  tim_p->tm_mon / 3 + 1);
+	  CHECK_LENGTH ();
+	  break;
 	case CQ('R'):
           len = snprintf (&s[count], maxsize - count, CQ("%.2d:%.2d"),
 			  tim_p->tm_hour, tim_p->tm_min);
@@ -1241,6 +1257,36 @@ recurse:
             CHECK_LENGTH ();
 	  }
           break;
+	case CQ('v'):	/* OSX/Ruby extension VMS/Oracle date format */
+	  { /* %v is equivalent to "%d-%b-%Y", flags and width can change year
+	       format. Recurse to avoid need to replicate %b and %Y formation. */
+	    CHAR fmtbuf[32], *fmt = fmtbuf;
+	    STRCPY (fmt, CQ("%d-%b-%"));
+	    fmt += strlen (fmt);
+	    if (pad) /* '0' or '+' */
+	      *fmt++ = pad;
+	    else
+	      *fmt++ = '+';
+	    if (!pad)
+	      width = 10;
+	    if (width < 6)
+	      width = 6;
+	    width -= 6;
+	    if (width)
+	      {
+		len = snprintf (fmt, fmtbuf + 32 - fmt, CQ("%lu"), width);
+		if (len > 0)
+		  fmt += len;
+	      }
+	    STRCPY (fmt, CQ("Y"));
+	    len = __strftime (&s[count], maxsize - count, fmtbuf, tim_p,
+			      locale, era_info, alt_digits);
+	    if (len > 0)
+	      count += len;
+	    else
+	      return 0;
+	  }
+	  break;
 	case CQ('w'):
 #ifdef _WANT_C99_TIME_FORMATS
 	  if (alt == CQ('O') && *alt_digits)
@@ -1270,6 +1316,7 @@ recurse:
             CHECK_LENGTH ();
 	  }
 	  break;
+	case CQ('i'):	/* Non-POSIX extension. */
 	case CQ('y'):
 	    {
 #ifdef _WANT_C99_TIME_FORMATS
@@ -1524,6 +1571,7 @@ const struct test  Vec0[] = {
 	{ CQ("%h"), 3+1, EXP(CQ("Dec")) },
 	{ CQ("%H"), 2+1, EXP(CQ("09")) },
 	{ CQ("%I"), 2+1, EXP(CQ("09")) },
+	{ CQ("%i"), 2+1, EXP(CQ("08")) },
 	{ CQ("%j"), 3+1, EXP(CQ("365")) },
 	{ CQ("%k"), 2+1, EXP(CQ(" 9")) },
 	{ CQ("%l"), 2+1, EXP(CQ(" 9")) },
@@ -1531,6 +1579,7 @@ const struct test  Vec0[] = {
 	{ CQ("%M"), 2+1, EXP(CQ("53")) },
 	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
 	{ CQ("%p"), 2+1, EXP(CQ("AM")) },
+	{ CQ("%q"), 1+1, EXP(CQ("4")) },
 	{ CQ("%r"), 11+1, EXP(CQ("09:53:47 AM")) },
 	{ CQ("%R"), 5+1, EXP(CQ("09:53")) },
 	{ CQ("%s"), 2+1, EXP(CQ("1230648827")) },
@@ -1540,6 +1589,7 @@ const struct test  Vec0[] = {
 	{ CQ("%u"), 1+1, EXP(CQ("2")) },
 	{ CQ("%U"), 2+1, EXP(CQ("52")) },
 	{ CQ("%V"), 2+1, EXP(CQ("01")) },
+	{ CQ("%v"), 11+1, EXP(CQ("30-Dec-2008")) },
 	{ CQ("%w"), 1+1, EXP(CQ("2")) },
 	{ CQ("%W"), 2+1, EXP(CQ("52")) },
 	{ CQ("%x"), 8+1, EXP(CQ("12/30/08")) },
@@ -1585,6 +1635,7 @@ const struct test  Vec1[] = {
 	{ CQ("%h"), 3+1, EXP(CQ("Jul")) },
 	{ CQ("%H"), 2+1, EXP(CQ("23")) },
 	{ CQ("%I"), 2+1, EXP(CQ("11")) },
+	{ CQ("%i"), 2+1, EXP(CQ("08")) },
 	{ CQ("%j"), 3+1, EXP(CQ("184")) },
 	{ CQ("%k"), 2+1, EXP(CQ("23")) },
 	{ CQ("%l"), 2+1, EXP(CQ("11")) },
@@ -1592,6 +1643,7 @@ const struct test  Vec1[] = {
 	{ CQ("%M"), 2+1, EXP(CQ("01")) },
 	{ CQ("%n"), 1+1, EXP(CQ("\n")) },
 	{ CQ("%p"), 2+1, EXP(CQ("PM")) },
+	{ CQ("%q"), 1+1, EXP(CQ("3")) },
 	{ CQ("%r"), 11+1, EXP(CQ("11:01:13 PM")) },
 	{ CQ("%R"), 5+1, EXP(CQ("23:01")) },
 	{ CQ("%s"), 2+1, EXP(CQ("1215054073")) },
@@ -1601,6 +1653,7 @@ const struct test  Vec1[] = {
 	{ CQ("%u"), 1+1, EXP(CQ("3")) },
 	{ CQ("%U"), 2+1, EXP(CQ("26")) },
 	{ CQ("%V"), 2+1, EXP(CQ("27")) },
+	{ CQ("%v"), 11+1, EXP(CQ("02-Jul-2008")) },
 	{ CQ("%w"), 1+1, EXP(CQ("3")) },
 	{ CQ("%W"), 2+1, EXP(CQ("26")) },
 	{ CQ("%x"), 8+1, EXP(CQ("07/02/08")) },
@@ -1662,6 +1715,8 @@ const struct test  Vecyr0[] = {
 	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
 	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%i"), OUTSIZE, EXP(Year) },
+	{ CQ("%v"), OUTSIZE, EXP(CQ("02-Jul-")YEAR) },
 	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%y"), OUTSIZE, EXP(Year) },
 	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
@@ -1708,6 +1763,8 @@ const struct test  Vecyr1[] = {
 	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:13 ")YEAR) },
 	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%i"), OUTSIZE, EXP(Year) },
+	{ CQ("%v"), OUTSIZE, EXP(CQ("02-Jul-")YEAR) },
 	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%y"), OUTSIZE, EXP(Year) },
 	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
@@ -1745,6 +1802,8 @@ const struct test  Vecyrzp[] = {
 	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:60 ")YEAR) },
 	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%i"), OUTSIZE, EXP(Year) },
+	{ CQ("%v"), OUTSIZE, EXP(CQ("02-Jul-")YEAR) },
 	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%y"), OUTSIZE, EXP(Year) },
 	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },
@@ -1780,6 +1839,8 @@ const struct test  Vecyrzn[] = {
 	{ CQ("%c"), OUTSIZE, EXP(CQ("Wed Jul  2 23:01:00 ")YEAR) },
 	{ CQ("%D"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%F"), OUTSIZE, EXP(YEAR CQ("-07-02")) },
+	{ CQ("%i"), OUTSIZE, EXP(Year) },
+	{ CQ("%v"), OUTSIZE, EXP(CQ("02-Jul-")YEAR) },
 	{ CQ("%x"), OUTSIZE, EXP(CQ("07/02/")Year) },
 	{ CQ("%y"), OUTSIZE, EXP(Year) },
 	{ CQ("%Y"), OUTSIZE, EXP(YEAR) },

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

* [PATCH 2/3] strptime.c(strptime_l): add %i, %q, %v
  2022-09-14  2:52 [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Brian Inglis
  2022-09-14  2:52 ` [PATCH 1/3] strftime.c(__strftime): " Brian Inglis
@ 2022-09-14  2:52 ` Brian Inglis
  2022-09-14  2:52 ` [PATCH 3/3] strptime.cc(__strptime): " Brian Inglis
  2022-09-15 17:45 ` [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Jon Turney
  3 siblings, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2022-09-14  2:52 UTC (permalink / raw)
  To: Cygwin Patches, Cygwin Patches; +Cc: Brian Inglis

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


newlib/libc/time/strptime.c(strptime_l):
%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]:
---
 newlib/libc/time/strptime.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)


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

diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c
index 12b2ef4695de..5e64af262516 100644
--- a/newlib/libc/time/strptime.c
+++ b/newlib/libc/time/strptime.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999 Kungliga Tekniska H?gskolan
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden). 
  * All rights reserved. 
  *
@@ -298,6 +298,14 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr,
 		} else
 		    timeptr->tm_hour += 12;
 		break;
+	    case 'q' :		/* quarter year - GNU extension */
+		ret = strtol_l (buf, &s, 10, locale);
+		if (s == buf)
+		    return NULL;
+		timeptr->tm_mon = (ret - 1)*3;
+		buf = s;
+		ymd |= SET_MON;
+		break;
 	    case 'r' :		/* %I:%M:%S %p */
 		s = strptime_l (buf, _ctloc (ampm_fmt), timeptr, locale);
 		if (s == NULL)
@@ -365,6 +373,13 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr,
 		buf = s;
 		ymd |= SET_WDAY;
 		break;
+	    case 'v' :	/* %d-%b-%Y - OSX/Ruby extension VMS/Oracle date */
+		s = strptime_l (buf, "%d-%b-%Y", timeptr, locale);
+		if (s == NULL || s == buf)
+		    return NULL;
+		buf = s;
+		ymd |= SET_YMD;
+		break;
 	    case 'U' :
 		ret = strtol_l (buf, &s, 10, locale);
 		if (s == buf)
@@ -402,6 +417,7 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr,
 		    return NULL;
 		buf = s;
 	    	break;
+	    case 'i' :	    /* Non-POSIX extension. */
 	    case 'y' :
 		ret = strtol_l (buf, &s, 10, locale);
 		if (s == buf)

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

* [PATCH 3/3] strptime.cc(__strptime): add %i, %q, %v
  2022-09-14  2:52 [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Brian Inglis
  2022-09-14  2:52 ` [PATCH 1/3] strftime.c(__strftime): " Brian Inglis
  2022-09-14  2:52 ` [PATCH 2/3] strptime.c(strptime_l): add %i, %q, %v Brian Inglis
@ 2022-09-14  2:52 ` Brian Inglis
  2022-09-15 17:45 ` [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Jon Turney
  3 siblings, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2022-09-14  2:52 UTC (permalink / raw)
  To: Cygwin Patches, Cygwin Patches; +Cc: Brian Inglis

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


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: 0003-strptime.cc-__strptime-add-i-q-v.patch --]
[-- Type: text/x-patch; name="0003-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)

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

* Re: [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs
  2022-09-14  2:52 [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Brian Inglis
                   ` (2 preceding siblings ...)
  2022-09-14  2:52 ` [PATCH 3/3] strptime.cc(__strptime): " Brian Inglis
@ 2022-09-15 17:45 ` Jon Turney
  2022-09-15 19:52   ` Brian Inglis
  3 siblings, 1 reply; 6+ messages in thread
From: Jon Turney @ 2022-09-15 17:45 UTC (permalink / raw)
  To: Brian Inglis, Cygwin Patches

On 14/09/2022 03:52, Brian Inglis wrote:
> [Please Reply All due to email issues]
> 
> newlib/libc/time/strftime.c(strftime): add %i, %q, %v, tests; tweak %Z docs
> newlib/libc/time/strptime.c(strptime_l): add %i, %q, %v
> winsup/cygwin/libc/strptime.cc(__strptime): add %i, %q, %v
> 
> %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]
> add %i %q %v tests
> %Z clarify current time zone *abbreviation* not "name" [tm_isdst]

The newlib patches should go to the newlib list.

Do you have a reference for an OS supporting the %i extension?  I'm just 
curious if it specifies the same pivot year for strptime() as POSIX does 
for %y?


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

* Re: [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs
  2022-09-15 17:45 ` [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Jon Turney
@ 2022-09-15 19:52   ` Brian Inglis
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Inglis @ 2022-09-15 19:52 UTC (permalink / raw)
  To: Jon Turney, Cygwin Patches

On 2022-09-15 11:45, Jon Turney wrote:
> On 14/09/2022 03:52, Brian Inglis wrote:
>> [Please Reply All due to email issues]
>>
>> newlib/libc/time/strftime.c(strftime): add %i, %q, %v, tests; tweak %Z 
>> docs
>> newlib/libc/time/strptime.c(strptime_l): add %i, %q, %v
>> winsup/cygwin/libc/strptime.cc(__strptime): add %i, %q, %v
>>
>> %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]
>> add %i %q %v tests
>> %Z clarify current time zone *abbreviation* not "name" [tm_isdst]
> 
> The newlib patches should go to the newlib list.

Right - okay - should have remembered - will split and add xrefs.

> Do you have a reference for an OS supporting the %i extension?  I'm just 
> curious if it specifies the same pivot year for strptime() as POSIX does 
> for %y?

It was documented as a synonym for %y, so %i uses the code for %y.
Sources supporting POSIX pivot at <= 68 => 2000, >= 69 => 1900.

Sorry, I couldn't find the sources for "%i year" when I went looking 
back thru my str[fp]time sources searches for comments - too many repos 
visited, no case sensitive search engines or page find strings, and 
everything supports %I US 12 hour clock and various year formats!
It may have been a newer language library implementation.
I don't keep copies of sources or links to avoid possibilities of 
plagiarism or influence, making it easier to follow existing approaches 
in the source files being changed.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

[For Y2K, two digit year formats were deprecated and upgraded, so I'm 
extremely disappointed, nay disgusted, that they still haven't been 
dropped, as they will continue to be ambiguous until 2031, as I flip 
between English language sites in various countries!
I'm in favour of promoting -Werror=format-y2k, similar to the common 
-Werror=format-security build option!
But given that few care to remember the issues, costs, solutions, and 
recommendations, I'll support adding the convenience format.]

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

end of thread, other threads:[~2022-09-15 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  2:52 [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Brian Inglis
2022-09-14  2:52 ` [PATCH 1/3] strftime.c(__strftime): " Brian Inglis
2022-09-14  2:52 ` [PATCH 2/3] strptime.c(strptime_l): add %i, %q, %v Brian Inglis
2022-09-14  2:52 ` [PATCH 3/3] strptime.cc(__strptime): " Brian Inglis
2022-09-15 17:45 ` [PATCH 0/3] strftime, strptime: add %i, %q, %v, tests; tweak %Z docs Jon Turney
2022-09-15 19:52   ` Brian Inglis

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