View | Details | Raw Unified | Return to bug 14817
Collapse All | Expand All

(-)strptime.c Thu Nov 11 00:38:39 1999 (-7 / +23 lines)
Lines 1-4 Link Here
1
/*
1
/*
2
 * 1999/11/11, cjclark@alum.mit.edu
3
 *
4
 * The '%C' conversion specification did not conform to the documentation
5
 * in strftime(3) or in the operation of 'date +%C'. Fixed. The '%C' 
6
 * conversion demands _exactly_ two digits (like the output) and must
7
 * be in the range 19-20. This 19-20 is converted to 0 or 100 being added
8
 * to tm_year.
9
 */
10
/*
2
 * Powerdog Industries kindly requests feedback from anyone modifying
11
 * Powerdog Industries kindly requests feedback from anyone modifying
3
 * this function:
12
 * this function:
4
 *
13
 *
Lines 115-126 Link Here
115
                               return 0;
124
                               return 0;
116
                       break;
125
                       break;
117
126
118
               case 'C':
119
                       buf = _strptime(buf, Locale->date_fmt, tm);
120
                       if (buf == 0)
121
                               return 0;
122
                       break;
123
124
               case 'c':
127
               case 'c':
125
                       buf = _strptime(buf, "%x %X", tm);
128
                       buf = _strptime(buf, "%x %X", tm);
126
                       if (buf == 0)
129
                       if (buf == 0)
Lines 163-169 Link Here
163
                               return 0;
166
                               return 0;
164
                       break;
167
                       break;
165
168
166
               case 'j':
169
               case 'C': /* "Century" (required to be two digits) */
170
                       if (!(isdigit((unsigned char)*buf) && isdigit((unsigned char)*(buf+1))))
171
                               return 0;
172
                       i = 10*(*buf++ - '0');
173
                       i += *buf++ - '0';
174
175
                       if ((i < 19) || (i > 20))
176
                         return 0;
177
178
                       tm->tm_year = i*100 - 1900;
179
180
                       break;
181
182
               case 'j': /* Day of year */
167
                       if (!isdigit((unsigned char)*buf))
183
                       if (!isdigit((unsigned char)*buf))
168
                               return 0;
184
                               return 0;

Return to bug 14817