1 /* Copyright (C) 2002-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
31 # define HAVE_LOCALTIME_R 0
32 # include "../locale/localeinfo.h"
36 #if ! HAVE_LOCALTIME_R && ! defined localtime_r
38 # define localtime_r __localtime_r
40 /* Approximate localtime_r as best we can in its absence. */
41 # define localtime_r my_localtime_r
42 static struct tm
*localtime_r (const time_t *, struct tm
*);
48 struct tm
*l
= localtime (t
);
55 #endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
58 #define match_char(ch1, ch2) if (ch1 != ch2) return NULL
59 #if defined __GNUC__ && __GNUC__ >= 2
60 # define match_string(cs1, s2) \
61 ({ size_t len = strlen (cs1); \
62 int result = __strncasecmp_l ((cs1), (s2), len, locale) == 0; \
63 if (result) (s2) += len; \
66 /* Oh come on. Get a reasonable compiler. */
67 # define match_string(cs1, s2) \
68 (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
70 /* We intentionally do not use isdigit() for testing because this will
71 lead to problems with the wide character version. */
72 #define get_number(from, to, n) \
76 while (ISSPACE (*rp)) \
78 if (*rp < '0' || *rp > '9') \
83 } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
84 if (val < from || val > to) \
88 # define get_alt_number(from, to, n) \
90 __label__ do_normal; \
92 if (s.decided != raw) \
94 val = _nl_parse_alt_digit (&rp HELPER_LOCALE_ARG); \
95 if (val == -1 && s.decided != loc) \
100 if (val < from || val > to) \
106 get_number (from, to, n); \
111 # define get_alt_number(from, to, n) \
112 /* We don't have the alternate representation. */ \
113 get_number(from, to, n)
115 #define recursive(new_fmt) \
116 (*(new_fmt) != '\0' \
117 && (rp = __strptime_internal (rp, (new_fmt), tm, &s LOCALE_ARG)) != NULL)
121 /* This is defined in locale/C-time.c in the GNU libc. */
122 extern const struct __locale_data _nl_C_LC_TIME attribute_hidden
;
124 # define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
125 # define ab_weekday_name \
126 (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
127 # define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
128 # define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
129 # define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
130 # define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
131 # define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
132 # define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
133 # define HERE_T_FMT_AMPM \
134 (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
135 # define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
137 # define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
139 static char const weekday_name
[][10] =
141 "Sunday", "Monday", "Tuesday", "Wednesday",
142 "Thursday", "Friday", "Saturday"
144 static char const ab_weekday_name
[][4] =
146 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
148 static char const month_name
[][10] =
150 "January", "February", "March", "April", "May", "June",
151 "July", "August", "September", "October", "November", "December"
153 static char const ab_month_name
[][4] =
155 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
156 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
158 # define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
159 # define HERE_D_FMT "%m/%d/%y"
160 # define HERE_AM_STR "AM"
161 # define HERE_PM_STR "PM"
162 # define HERE_T_FMT_AMPM "%I:%M:%S %p"
163 # define HERE_T_FMT "%H:%M:%S"
165 static const unsigned short int __mon_yday
[2][13] =
168 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
170 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
175 /* We use this code also for the extended locale handling where the
176 function gets as an additional argument the locale which has to be
177 used. To access the values we have to redefine the _NL_CURRENT
179 # define strptime __strptime_l
181 # define _NL_CURRENT(category, item) \
182 (current->values[_NL_ITEM_INDEX (item)].string)
183 # undef _NL_CURRENT_WORD
184 # define _NL_CURRENT_WORD(category, item) \
185 (current->values[_NL_ITEM_INDEX (item)].word)
186 # define LOCALE_PARAM , locale
187 # define LOCALE_ARG , locale
188 # define LOCALE_PARAM_PROTO , __locale_t locale
189 # define LOCALE_PARAM_DECL __locale_t locale;
190 # define HELPER_LOCALE_ARG , current
191 # define ISSPACE(Ch) __isspace_l (Ch, locale)
193 # define LOCALE_PARAM
195 # define LOCALE_PARAM_DECL
196 # define LOCALE_PARAM_PROTO
197 # define HELPER_LOCALE_ARG
198 # define ISSPACE(Ch) isspace (Ch)
205 /* Nonzero if YEAR is a leap year (every 4 years,
206 except every 100th isn't, and every 400th is). */
207 # define __isleap(year) \
208 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
211 /* Compute the day of the week. */
213 day_of_the_week (struct tm
*tm
)
215 /* We know that January 1st 1970 was a Thursday (= 4). Compute the
216 difference between this data in the one on TM and so determine
218 int corr_year
= 1900 + tm
->tm_year
- (tm
->tm_mon
< 2);
220 + (365 * (tm
->tm_year
- 70))
222 - ((corr_year
/ 4) / 25) + ((corr_year
/ 4) % 25 < 0)
223 + (((corr_year
/ 4) / 25) / 4)
224 + __mon_yday
[0][tm
->tm_mon
]
226 tm
->tm_wday
= ((wday
% 7) + 7) % 7;
229 /* Compute the day of the year. */
231 day_of_the_year (struct tm
*tm
)
233 tm
->tm_yday
= (__mon_yday
[__isleap (1900 + tm
->tm_year
)][tm
->tm_mon
]
234 + (tm
->tm_mday
- 1));
244 __strptime_internal (rp
, fmt
, tmp
, statep LOCALE_PARAM
)
252 struct __locale_data
*const current
= locale
->__locales
[LC_TIME
];
255 const char *rp_backup
;
256 const char *rp_longest
;
261 struct era_entry
*era
= NULL
;
262 enum ptime_locale_status
{ not, loc
, raw
} decided_longest
;
263 struct __strptime_state
265 unsigned int have_I
: 1;
266 unsigned int have_wday
: 1;
267 unsigned int have_yday
: 1;
268 unsigned int have_mon
: 1;
269 unsigned int have_mday
: 1;
270 unsigned int have_uweek
: 1;
271 unsigned int have_wweek
: 1;
272 unsigned int is_pm
: 1;
273 unsigned int want_century
: 1;
274 unsigned int want_era
: 1;
275 unsigned int want_xday
: 1;
276 enum ptime_locale_status decided
: 2;
286 memset (&s
, 0, sizeof (s
));
298 s
= *(struct __strptime_state
*) statep
;
305 /* A white space in the format string matches 0 more or white
306 space in the input string. */
309 while (ISSPACE (*rp
))
315 /* Any character but `%' must be matched by the same character
316 in the iput string. */
319 match_char (*fmt
++, *rp
++);
324 /* We discard strftime modifiers. */
325 while (*fmt
== '-' || *fmt
== '_' || *fmt
== '0'
326 || *fmt
== '^' || *fmt
== '#')
329 /* And field width. */
330 while (*fmt
>= '0' && *fmt
<= '9')
334 /* We need this for handling the `E' modifier. */
338 /* Make back up of current processing pointer. */
344 /* Match the `%' character itself. */
345 match_char ('%', *rp
++);
349 /* Match day of week. */
351 decided_longest
= s
.decided
;
353 for (cnt
= 0; cnt
< 7; ++cnt
)
360 if (match_string (_NL_CURRENT (LC_TIME
, DAY_1
+ cnt
), trp
)
366 && strcmp (_NL_CURRENT (LC_TIME
, DAY_1
+ cnt
),
368 decided_longest
= loc
;
371 if (match_string (_NL_CURRENT (LC_TIME
, ABDAY_1
+ cnt
), trp
)
377 && strcmp (_NL_CURRENT (LC_TIME
, ABDAY_1
+ cnt
),
378 ab_weekday_name
[cnt
]))
379 decided_longest
= loc
;
384 && (((trp
= rp
, match_string (weekday_name
[cnt
], trp
))
386 || ((trp
= rp
, match_string (ab_weekday_name
[cnt
], rp
))
387 && trp
> rp_longest
)))
391 decided_longest
= raw
;
394 if (rp_longest
== NULL
)
395 /* Does not match a weekday name. */
398 s
.decided
= decided_longest
;
399 tm
->tm_wday
= cnt_longest
;
405 /* Match month name. */
407 decided_longest
= s
.decided
;
409 for (cnt
= 0; cnt
< 12; ++cnt
)
416 if (match_string (_NL_CURRENT (LC_TIME
, MON_1
+ cnt
), trp
)
422 && strcmp (_NL_CURRENT (LC_TIME
, MON_1
+ cnt
),
424 decided_longest
= loc
;
427 if (match_string (_NL_CURRENT (LC_TIME
, ABMON_1
+ cnt
), trp
)
433 && strcmp (_NL_CURRENT (LC_TIME
, ABMON_1
+ cnt
),
435 decided_longest
= loc
;
440 && (((trp
= rp
, match_string (month_name
[cnt
], trp
))
442 || ((trp
= rp
, match_string (ab_month_name
[cnt
], trp
))
443 && trp
> rp_longest
)))
447 decided_longest
= raw
;
450 if (rp_longest
== NULL
)
451 /* Does not match a month name. */
454 s
.decided
= decided_longest
;
455 tm
->tm_mon
= cnt_longest
;
460 /* Match locale's date and time format. */
462 if (s
.decided
!= raw
)
464 if (!recursive (_NL_CURRENT (LC_TIME
, D_T_FMT
)))
466 if (s
.decided
== loc
)
473 if (s
.decided
== not &&
474 strcmp (_NL_CURRENT (LC_TIME
, D_T_FMT
), HERE_D_T_FMT
))
482 if (!recursive (HERE_D_T_FMT
))
487 /* Match century number. */
489 get_number (0, 99, 2);
495 /* Match day of month. */
496 get_number (1, 31, 2);
502 if (!recursive ("%Y-%m-%d"))
508 if (s
.decided
!= raw
)
510 if (!recursive (_NL_CURRENT (LC_TIME
, D_FMT
)))
512 if (s
.decided
== loc
)
520 && strcmp (_NL_CURRENT (LC_TIME
, D_FMT
), HERE_D_FMT
))
530 /* Match standard day format. */
531 if (!recursive (HERE_D_FMT
))
537 /* Match hour in 24-hour clock. */
538 get_number (0, 23, 2);
543 /* Match hour in 12-hour clock. GNU extension. */
545 /* Match hour in 12-hour clock. */
546 get_number (1, 12, 2);
547 tm
->tm_hour
= val
% 12;
551 /* Match day number of year. */
552 get_number (1, 366, 3);
553 tm
->tm_yday
= val
- 1;
557 /* Match number of month. */
558 get_number (1, 12, 2);
559 tm
->tm_mon
= val
- 1;
565 get_number (0, 59, 2);
570 /* Match any white space. */
571 while (ISSPACE (*rp
))
575 /* Match locale's equivalent of AM/PM. */
577 if (s
.decided
!= raw
)
579 if (match_string (_NL_CURRENT (LC_TIME
, AM_STR
), rp
))
581 if (strcmp (_NL_CURRENT (LC_TIME
, AM_STR
), HERE_AM_STR
))
586 if (match_string (_NL_CURRENT (LC_TIME
, PM_STR
), rp
))
588 if (strcmp (_NL_CURRENT (LC_TIME
, PM_STR
), HERE_PM_STR
))
596 if (!match_string (HERE_AM_STR
, rp
))
598 if (match_string (HERE_PM_STR
, rp
))
608 if (s
.decided
!= raw
)
610 if (!recursive (_NL_CURRENT (LC_TIME
, T_FMT_AMPM
)))
612 if (s
.decided
== loc
)
619 if (s
.decided
== not &&
620 strcmp (_NL_CURRENT (LC_TIME
, T_FMT_AMPM
),
628 if (!recursive (HERE_T_FMT_AMPM
))
632 if (!recursive ("%H:%M"))
637 /* The number of seconds may be very high so we cannot use
638 the `get_number' macro. Instead read the number
639 character for character and construct the result while
642 if (*rp
< '0' || *rp
> '9')
643 /* We need at least one digit. */
651 while (*rp
>= '0' && *rp
<= '9');
653 if (localtime_r (&secs
, tm
) == NULL
)
654 /* Error in function. */
659 get_number (0, 61, 2);
664 if (s
.decided
!= raw
)
666 if (!recursive (_NL_CURRENT (LC_TIME
, T_FMT
)))
668 if (s
.decided
== loc
)
675 if (strcmp (_NL_CURRENT (LC_TIME
, T_FMT
), HERE_T_FMT
))
684 if (!recursive (HERE_T_FMT
))
688 get_number (1, 7, 1);
689 tm
->tm_wday
= val
% 7;
693 get_number (0, 99, 2);
694 /* XXX This cannot determine any field in TM. */
697 if (*rp
< '0' || *rp
> '9')
699 /* XXX Ignore the number since we would need some more
700 information to compute a real date. */
703 while (*rp
>= '0' && *rp
<= '9');
706 get_number (0, 53, 2);
711 get_number (0, 53, 2);
716 get_number (0, 53, 2);
717 /* XXX This cannot determine any field in TM without some
721 /* Match number of weekday. */
722 get_number (0, 6, 1);
727 match_year_in_century
:
728 /* Match year within century. */
729 get_number (0, 99, 2);
730 /* The "Year 2000: The Millennium Rollover" paper suggests that
731 values in the range 69-99 refer to the twentieth century. */
732 tm
->tm_year
= val
>= 69 ? val
: val
+ 100;
733 /* Indicate that we want to use the century, if specified. */
738 /* Match year including century number. */
739 get_number (0, 9999, 4);
740 tm
->tm_year
= val
- 1900;
745 /* Read timezone but perform no conversion. */
746 while (ISSPACE (*rp
))
748 while (!ISSPACE (*rp
) && *rp
!= '\0')
752 /* We recognize two formats: if two digits are given, these
753 specify hours. If fours digits are used, minutes are
757 while (ISSPACE (*rp
))
759 if (*rp
!= '+' && *rp
!= '-')
761 bool neg
= *rp
++ == '-';
763 while (n
< 4 && *rp
>= '0' && *rp
<= '9')
765 val
= val
* 10 + *rp
++ - '0';
771 /* Only two or four digits recognized. */
775 /* We have to convert the minutes into decimal. */
778 val
= (val
/ 100) * 100 + ((val
% 100) * 50) / 30;
782 tm
->tm_gmtoff
= (val
* 3600) / 100;
784 tm
->tm_gmtoff
= -tm
->tm_gmtoff
;
792 /* Match locale's alternate date and time format. */
793 if (s
.decided
!= raw
)
795 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_D_T_FMT
);
798 fmt
= _NL_CURRENT (LC_TIME
, D_T_FMT
);
800 if (!recursive (fmt
))
802 if (s
.decided
== loc
)
809 if (strcmp (fmt
, HERE_D_T_FMT
))
816 /* The C locale has no era information, so use the
817 normal representation. */
818 if (!recursive (HERE_D_T_FMT
))
823 if (s
.decided
!= raw
)
827 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
828 if (era
!= NULL
&& match_string (era
->era_name
, rp
))
837 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
838 _NL_TIME_ERA_NUM_ENTRIES
);
839 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
;
840 ++s
.era_cnt
, rp
= rp_backup
)
842 era
= _nl_select_era_entry (s
.era_cnt
844 if (era
!= NULL
&& match_string (era
->era_name
, rp
))
850 if (s
.era_cnt
!= (int) num_eras
)
854 if (s
.decided
== loc
)
859 /* The C locale has no era information, so use the
860 normal representation. */
863 if (s
.decided
!= raw
)
865 get_number(0, 9999, 4);
873 assert (s
.decided
== loc
);
875 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
879 int delta
= ((tm
->tm_year
- era
->offset
)
880 * era
->absolute_direction
);
882 && delta
< (((int64_t) era
->stop_date
[0]
883 - (int64_t) era
->start_date
[0])
884 * era
->absolute_direction
));
892 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
893 _NL_TIME_ERA_NUM_ENTRIES
);
894 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
; ++s
.era_cnt
)
896 era
= _nl_select_era_entry (s
.era_cnt
900 int delta
= ((tm
->tm_year
- era
->offset
)
901 * era
->absolute_direction
);
903 && delta
< (((int64_t) era
->stop_date
[0]
904 - (int64_t) era
->start_date
[0])
905 * era
->absolute_direction
))
912 if (s
.era_cnt
!= (int) num_eras
)
916 if (s
.decided
== loc
)
922 goto match_year_in_century
;
924 if (s
.decided
!= raw
)
926 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
927 _NL_TIME_ERA_NUM_ENTRIES
);
928 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
;
929 ++s
.era_cnt
, rp
= rp_backup
)
931 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
932 if (era
!= NULL
&& recursive (era
->era_format
))
935 if (s
.era_cnt
== (int) num_eras
)
938 if (s
.decided
== loc
)
951 get_number (0, 9999, 4);
952 tm
->tm_year
= val
- 1900;
957 if (s
.decided
!= raw
)
959 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_D_FMT
);
962 fmt
= _NL_CURRENT (LC_TIME
, D_FMT
);
964 if (!recursive (fmt
))
966 if (s
.decided
== loc
)
973 if (strcmp (fmt
, HERE_D_FMT
))
979 if (!recursive (HERE_D_FMT
))
983 if (s
.decided
!= raw
)
985 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_T_FMT
);
988 fmt
= _NL_CURRENT (LC_TIME
, T_FMT
);
990 if (!recursive (fmt
))
992 if (s
.decided
== loc
)
999 if (strcmp (fmt
, HERE_T_FMT
))
1005 if (!recursive (HERE_T_FMT
))
1013 /* We have no information about the era format. Just use
1014 the normal format. */
1015 if (*fmt
!= 'c' && *fmt
!= 'C' && *fmt
!= 'y' && *fmt
!= 'Y'
1016 && *fmt
!= 'x' && *fmt
!= 'X')
1017 /* This is an illegal format. */
1027 /* Match day of month using alternate numeric symbols. */
1028 get_alt_number (1, 31, 2);
1034 /* Match hour in 24-hour clock using alternate numeric
1036 get_alt_number (0, 23, 2);
1041 /* Match hour in 12-hour clock using alternate numeric
1043 get_alt_number (1, 12, 2);
1044 tm
->tm_hour
= val
% 12;
1048 /* Match month using alternate numeric symbols. */
1049 get_alt_number (1, 12, 2);
1050 tm
->tm_mon
= val
- 1;
1055 /* Match minutes using alternate numeric symbols. */
1056 get_alt_number (0, 59, 2);
1060 /* Match seconds using alternate numeric symbols. */
1061 get_alt_number (0, 61, 2);
1065 get_alt_number (0, 53, 2);
1070 get_alt_number (0, 53, 2);
1075 get_alt_number (0, 53, 2);
1076 /* XXX This cannot determine any field in TM without
1077 further information. */
1080 /* Match number of weekday using alternate numeric symbols. */
1081 get_alt_number (0, 6, 1);
1086 /* Match year within century using alternate numeric symbols. */
1087 get_alt_number (0, 99, 2);
1088 tm
->tm_year
= val
>= 69 ? val
: val
+ 100;
1102 /* Recursive invocation, returning success, so
1103 update parent's struct tm and state. */
1104 *(struct __strptime_state
*) statep
= s
;
1109 if (s
.have_I
&& s
.is_pm
)
1112 if (s
.century
!= -1)
1115 tm
->tm_year
= tm
->tm_year
% 100 + (s
.century
- 19) * 100;
1117 /* Only the century, but not the year. Strange, but so be it. */
1118 tm
->tm_year
= (s
.century
- 19) * 100;
1121 if (s
.era_cnt
!= -1)
1123 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
1127 tm
->tm_year
= (era
->start_date
[0]
1128 + ((tm
->tm_year
- era
->offset
)
1129 * era
->absolute_direction
));
1131 /* Era start year assumed. */
1132 tm
->tm_year
= era
->start_date
[0];
1137 /* No era found but we have seen an E modifier. Rectify some
1139 if (s
.want_century
&& s
.century
== -1 && tm
->tm_year
< 69)
1143 if (s
.want_xday
&& !s
.have_wday
)
1145 if ( !(s
.have_mon
&& s
.have_mday
) && s
.have_yday
)
1147 /* We don't have tm_mon and/or tm_mday, compute them. */
1149 while (__mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
] <= tm
->tm_yday
)
1152 tm
->tm_mon
= t_mon
- 1;
1156 - __mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
- 1] + 1);
1160 /* Don't crash in day_of_the_week if tm_mon is uninitialized. */
1161 if (s
.have_mon
|| (unsigned) tm
->tm_mon
<= 11)
1162 day_of_the_week (tm
);
1165 if (s
.want_xday
&& !s
.have_yday
&& (s
.have_mon
|| (unsigned) tm
->tm_mon
<= 11))
1166 day_of_the_year (tm
);
1168 if ((s
.have_uweek
|| s
.have_wweek
) && s
.have_wday
)
1170 int save_wday
= tm
->tm_wday
;
1171 int save_mday
= tm
->tm_mday
;
1172 int save_mon
= tm
->tm_mon
;
1173 int w_offset
= s
.have_uweek
? 0 : 1;
1177 day_of_the_week (tm
);
1179 tm
->tm_mday
= save_mday
;
1181 tm
->tm_mon
= save_mon
;
1184 tm
->tm_yday
= ((7 - (tm
->tm_wday
- w_offset
)) % 7
1185 + (s
.week_no
- 1) * 7
1186 + (save_wday
- w_offset
+ 7) % 7);
1188 if (!s
.have_mday
|| !s
.have_mon
)
1191 while (__mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
]
1195 tm
->tm_mon
= t_mon
- 1;
1199 - __mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
- 1] + 1);
1202 tm
->tm_wday
= save_wday
;
1210 strptime (buf
, format
, tm LOCALE_PARAM
)
1216 return __strptime_internal (buf
, format
, tm
, NULL LOCALE_ARG
);
1220 weak_alias (__strptime_l
, strptime_l
)