FreeBSD Bugzilla – Attachment 6585 Details for
Bug 14817
strptime(3) '%C' conversion incorrect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.71 KB, created by
Crist J. Clark
on 1999-11-11 05:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Crist J. Clark
Created:
1999-11-11 05:40:01 UTC
Size:
1.71 KB
patch
obsolete
>--- /usr/src/lib/libc/stdtime/strptime.c Sun Aug 29 21:55:58 1999 >+++ strptime.c Thu Nov 11 00:38:39 1999 >@@ -1,4 +1,13 @@ > /* >+ * 1999/11/11, cjclark@alum.mit.edu >+ * >+ * The '%C' conversion specification did not conform to the documentation >+ * in strftime(3) or in the operation of 'date +%C'. Fixed. The '%C' >+ * conversion demands _exactly_ two digits (like the output) and must >+ * be in the range 19-20. This 19-20 is converted to 0 or 100 being added >+ * to tm_year. >+ */ >+/* > * Powerdog Industries kindly requests feedback from anyone modifying > * this function: > * >@@ -115,12 +124,6 @@ > return 0; > break; > >- case 'C': >- buf = _strptime(buf, Locale->date_fmt, tm); >- if (buf == 0) >- return 0; >- break; >- > case 'c': > buf = _strptime(buf, "%x %X", tm); > if (buf == 0) >@@ -163,7 +166,20 @@ > return 0; > break; > >- case 'j': >+ case 'C': /* "Century" (required to be two digits) */ >+ if (!(isdigit((unsigned char)*buf) && isdigit((unsigned char)*(buf+1)))) >+ return 0; >+ i = 10*(*buf++ - '0'); >+ i += *buf++ - '0'; >+ >+ if ((i < 19) || (i > 20)) >+ return 0; >+ >+ tm->tm_year = i*100 - 1900; >+ >+ break; >+ >+ case 'j': /* Day of year */ > if (!isdigit((unsigned char)*buf)) > return 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14817
: 6585