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 # include "../locale/localeinfo.h"
35 #if ! HAVE_LOCALTIME_R && ! defined localtime_r
37 # define localtime_r __localtime_r
39 /* Approximate localtime_r as best we can in its absence. */
40 # define localtime_r my_localtime_r
41 static struct tm
*localtime_r (const time_t *, struct tm
*);
47 struct tm
*l
= localtime (t
);
54 #endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
57 #define match_char(ch1, ch2) if (ch1 != ch2) return NULL
58 #if defined __GNUC__ && __GNUC__ >= 2
59 # define match_string(cs1, s2) \
60 ({ size_t len = strlen (cs1); \
61 int result = __strncasecmp_l ((cs1), (s2), len, locale) == 0; \
62 if (result) (s2) += len; \
65 /* Oh come on. Get a reasonable compiler. */
66 # define match_string(cs1, s2) \
67 (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
69 /* We intentionally do not use isdigit() for testing because this will
70 lead to problems with the wide character version. */
71 #define get_number(from, to, n) \
75 while (ISSPACE (*rp)) \
77 if (*rp < '0' || *rp > '9') \
82 } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
83 if (val < from || val > to) \
87 # define get_alt_number(from, to, n) \
89 __label__ do_normal; \
91 if (s.decided != raw) \
93 val = _nl_parse_alt_digit (&rp HELPER_LOCALE_ARG); \
94 if (val == -1 && s.decided != loc) \
99 if (val < from || val > to) \
105 get_number (from, to, n); \
110 # define get_alt_number(from, to, n) \
111 /* We don't have the alternate representation. */ \
112 get_number(from, to, n)
114 #define recursive(new_fmt) \
115 (*(new_fmt) != '\0' \
116 && (rp = __strptime_internal (rp, (new_fmt), tm, &s LOCALE_ARG)) != NULL)
120 /* This is defined in locale/C-time.c in the GNU libc. */
121 extern const struct __locale_data _nl_C_LC_TIME attribute_hidden
;
123 # define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
124 # define ab_weekday_name \
125 (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
126 # define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
127 # define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
128 # define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
129 # define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
130 # define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
131 # define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
132 # define HERE_T_FMT_AMPM \
133 (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
134 # define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
136 # define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
138 static char const weekday_name
[][10] =
140 "Sunday", "Monday", "Tuesday", "Wednesday",
141 "Thursday", "Friday", "Saturday"
143 static char const ab_weekday_name
[][4] =
145 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
147 static char const month_name
[][10] =
149 "January", "February", "March", "April", "May", "June",
150 "July", "August", "September", "October", "November", "December"
152 static char const ab_month_name
[][4] =
154 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
155 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
157 # define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
158 # define HERE_D_FMT "%m/%d/%y"
159 # define HERE_AM_STR "AM"
160 # define HERE_PM_STR "PM"
161 # define HERE_T_FMT_AMPM "%I:%M:%S %p"
162 # define HERE_T_FMT "%H:%M:%S"
164 static const unsigned short int __mon_yday
[2][13] =
167 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
169 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
174 /* We use this code also for the extended locale handling where the
175 function gets as an additional argument the locale which has to be
176 used. To access the values we have to redefine the _NL_CURRENT
178 # define strptime __strptime_l
180 # define _NL_CURRENT(category, item) \
181 (current->values[_NL_ITEM_INDEX (item)].string)
182 # undef _NL_CURRENT_WORD
183 # define _NL_CURRENT_WORD(category, item) \
184 (current->values[_NL_ITEM_INDEX (item)].word)
185 # define LOCALE_PARAM , locale
186 # define LOCALE_ARG , locale
187 # define LOCALE_PARAM_PROTO , __locale_t locale
188 # define LOCALE_PARAM_DECL __locale_t locale;
189 # define HELPER_LOCALE_ARG , current
190 # define ISSPACE(Ch) __isspace_l (Ch, locale)
192 # define LOCALE_PARAM
194 # define LOCALE_PARAM_DECL
195 # define LOCALE_PARAM_PROTO
196 # define HELPER_LOCALE_ARG
197 # define ISSPACE(Ch) isspace (Ch)
204 /* Nonzero if YEAR is a leap year (every 4 years,
205 except every 100th isn't, and every 400th is). */
206 # define __isleap(year) \
207 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
210 /* Compute the day of the week. */
212 day_of_the_week (struct tm
*tm
)
214 /* We know that January 1st 1970 was a Thursday (= 4). Compute the
215 difference between this data in the one on TM and so determine
217 int corr_year
= 1900 + tm
->tm_year
- (tm
->tm_mon
< 2);
219 + (365 * (tm
->tm_year
- 70))
221 - ((corr_year
/ 4) / 25) + ((corr_year
/ 4) % 25 < 0)
222 + (((corr_year
/ 4) / 25) / 4)
223 + __mon_yday
[0][tm
->tm_mon
]
225 tm
->tm_wday
= ((wday
% 7) + 7) % 7;
228 /* Compute the day of the year. */
230 day_of_the_year (struct tm
*tm
)
232 tm
->tm_yday
= (__mon_yday
[__isleap (1900 + tm
->tm_year
)][tm
->tm_mon
]
233 + (tm
->tm_mday
- 1));
243 __strptime_internal (rp
, fmt
, tmp
, statep LOCALE_PARAM
)
251 struct __locale_data
*const current
= locale
->__locales
[LC_TIME
];
254 const char *rp_backup
;
255 const char *rp_longest
;
260 struct era_entry
*era
= NULL
;
261 enum ptime_locale_status
{ not, loc
, raw
} decided_longest
;
262 struct __strptime_state
264 unsigned int have_I
: 1;
265 unsigned int have_wday
: 1;
266 unsigned int have_yday
: 1;
267 unsigned int have_mon
: 1;
268 unsigned int have_mday
: 1;
269 unsigned int have_uweek
: 1;
270 unsigned int have_wweek
: 1;
271 unsigned int is_pm
: 1;
272 unsigned int want_century
: 1;
273 unsigned int want_era
: 1;
274 unsigned int want_xday
: 1;
275 enum ptime_locale_status decided
: 2;
285 memset (&s
, 0, sizeof (s
));
297 s
= *(struct __strptime_state
*) statep
;
304 /* A white space in the format string matches 0 more or white
305 space in the input string. */
308 while (ISSPACE (*rp
))
314 /* Any character but `%' must be matched by the same character
315 in the iput string. */
318 match_char (*fmt
++, *rp
++);
323 /* We discard strftime modifiers. */
324 while (*fmt
== '-' || *fmt
== '_' || *fmt
== '0'
325 || *fmt
== '^' || *fmt
== '#')
328 /* And field width. */
329 while (*fmt
>= '0' && *fmt
<= '9')
333 /* We need this for handling the `E' modifier. */
337 /* Make back up of current processing pointer. */
343 /* Match the `%' character itself. */
344 match_char ('%', *rp
++);
348 /* Match day of week. */
350 decided_longest
= s
.decided
;
352 for (cnt
= 0; cnt
< 7; ++cnt
)
359 if (match_string (_NL_CURRENT (LC_TIME
, DAY_1
+ cnt
), trp
)
365 && strcmp (_NL_CURRENT (LC_TIME
, DAY_1
+ cnt
),
367 decided_longest
= loc
;
370 if (match_string (_NL_CURRENT (LC_TIME
, ABDAY_1
+ cnt
), trp
)
376 && strcmp (_NL_CURRENT (LC_TIME
, ABDAY_1
+ cnt
),
377 ab_weekday_name
[cnt
]))
378 decided_longest
= loc
;
383 && (((trp
= rp
, match_string (weekday_name
[cnt
], trp
))
385 || ((trp
= rp
, match_string (ab_weekday_name
[cnt
], rp
))
386 && trp
> rp_longest
)))
390 decided_longest
= raw
;
393 if (rp_longest
== NULL
)
394 /* Does not match a weekday name. */
397 s
.decided
= decided_longest
;
398 tm
->tm_wday
= cnt_longest
;
404 /* Match month name. */
406 decided_longest
= s
.decided
;
408 for (cnt
= 0; cnt
< 12; ++cnt
)
415 if (match_string (_NL_CURRENT (LC_TIME
, MON_1
+ cnt
), trp
)
421 && strcmp (_NL_CURRENT (LC_TIME
, MON_1
+ cnt
),
423 decided_longest
= loc
;
426 if (match_string (_NL_CURRENT (LC_TIME
, ABMON_1
+ cnt
), trp
)
432 && strcmp (_NL_CURRENT (LC_TIME
, ABMON_1
+ cnt
),
434 decided_longest
= loc
;
439 && (((trp
= rp
, match_string (month_name
[cnt
], trp
))
441 || ((trp
= rp
, match_string (ab_month_name
[cnt
], trp
))
442 && trp
> rp_longest
)))
446 decided_longest
= raw
;
449 if (rp_longest
== NULL
)
450 /* Does not match a month name. */
453 s
.decided
= decided_longest
;
454 tm
->tm_mon
= cnt_longest
;
459 /* Match locale's date and time format. */
461 if (s
.decided
!= raw
)
463 if (!recursive (_NL_CURRENT (LC_TIME
, D_T_FMT
)))
465 if (s
.decided
== loc
)
472 if (s
.decided
== not &&
473 strcmp (_NL_CURRENT (LC_TIME
, D_T_FMT
), HERE_D_T_FMT
))
481 if (!recursive (HERE_D_T_FMT
))
486 /* Match century number. */
488 get_number (0, 99, 2);
494 /* Match day of month. */
495 get_number (1, 31, 2);
501 if (!recursive ("%Y-%m-%d"))
507 if (s
.decided
!= raw
)
509 if (!recursive (_NL_CURRENT (LC_TIME
, D_FMT
)))
511 if (s
.decided
== loc
)
519 && strcmp (_NL_CURRENT (LC_TIME
, D_FMT
), HERE_D_FMT
))
529 /* Match standard day format. */
530 if (!recursive (HERE_D_FMT
))
536 /* Match hour in 24-hour clock. */
537 get_number (0, 23, 2);
542 /* Match hour in 12-hour clock. GNU extension. */
544 /* Match hour in 12-hour clock. */
545 get_number (1, 12, 2);
546 tm
->tm_hour
= val
% 12;
550 /* Match day number of year. */
551 get_number (1, 366, 3);
552 tm
->tm_yday
= val
- 1;
556 /* Match number of month. */
557 get_number (1, 12, 2);
558 tm
->tm_mon
= val
- 1;
564 get_number (0, 59, 2);
569 /* Match any white space. */
570 while (ISSPACE (*rp
))
574 /* Match locale's equivalent of AM/PM. */
576 if (s
.decided
!= raw
)
578 if (match_string (_NL_CURRENT (LC_TIME
, AM_STR
), rp
))
580 if (strcmp (_NL_CURRENT (LC_TIME
, AM_STR
), HERE_AM_STR
))
585 if (match_string (_NL_CURRENT (LC_TIME
, PM_STR
), rp
))
587 if (strcmp (_NL_CURRENT (LC_TIME
, PM_STR
), HERE_PM_STR
))
595 if (!match_string (HERE_AM_STR
, rp
))
597 if (match_string (HERE_PM_STR
, rp
))
607 if (s
.decided
!= raw
)
609 if (!recursive (_NL_CURRENT (LC_TIME
, T_FMT_AMPM
)))
611 if (s
.decided
== loc
)
618 if (s
.decided
== not &&
619 strcmp (_NL_CURRENT (LC_TIME
, T_FMT_AMPM
),
627 if (!recursive (HERE_T_FMT_AMPM
))
631 if (!recursive ("%H:%M"))
636 /* The number of seconds may be very high so we cannot use
637 the `get_number' macro. Instead read the number
638 character for character and construct the result while
641 if (*rp
< '0' || *rp
> '9')
642 /* We need at least one digit. */
650 while (*rp
>= '0' && *rp
<= '9');
652 if (localtime_r (&secs
, tm
) == NULL
)
653 /* Error in function. */
658 get_number (0, 61, 2);
663 if (s
.decided
!= raw
)
665 if (!recursive (_NL_CURRENT (LC_TIME
, T_FMT
)))
667 if (s
.decided
== loc
)
674 if (strcmp (_NL_CURRENT (LC_TIME
, T_FMT
), HERE_T_FMT
))
683 if (!recursive (HERE_T_FMT
))
687 get_number (1, 7, 1);
688 tm
->tm_wday
= val
% 7;
692 get_number (0, 99, 2);
693 /* XXX This cannot determine any field in TM. */
696 if (*rp
< '0' || *rp
> '9')
698 /* XXX Ignore the number since we would need some more
699 information to compute a real date. */
702 while (*rp
>= '0' && *rp
<= '9');
705 get_number (0, 53, 2);
710 get_number (0, 53, 2);
715 get_number (0, 53, 2);
716 /* XXX This cannot determine any field in TM without some
720 /* Match number of weekday. */
721 get_number (0, 6, 1);
726 match_year_in_century
:
727 /* Match year within century. */
728 get_number (0, 99, 2);
729 /* The "Year 2000: The Millennium Rollover" paper suggests that
730 values in the range 69-99 refer to the twentieth century. */
731 tm
->tm_year
= val
>= 69 ? val
: val
+ 100;
732 /* Indicate that we want to use the century, if specified. */
737 /* Match year including century number. */
738 get_number (0, 9999, 4);
739 tm
->tm_year
= val
- 1900;
744 /* Read timezone but perform no conversion. */
745 while (ISSPACE (*rp
))
747 while (!ISSPACE (*rp
) && *rp
!= '\0')
751 /* We recognize two formats: if two digits are given, these
752 specify hours. If fours digits are used, minutes are
756 while (ISSPACE (*rp
))
758 if (*rp
!= '+' && *rp
!= '-')
760 bool neg
= *rp
++ == '-';
762 while (n
< 4 && *rp
>= '0' && *rp
<= '9')
764 val
= val
* 10 + *rp
++ - '0';
770 /* Only two or four digits recognized. */
774 /* We have to convert the minutes into decimal. */
777 val
= (val
/ 100) * 100 + ((val
% 100) * 50) / 30;
781 tm
->tm_gmtoff
= (val
* 3600) / 100;
783 tm
->tm_gmtoff
= -tm
->tm_gmtoff
;
791 /* Match locale's alternate date and time format. */
792 if (s
.decided
!= raw
)
794 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_D_T_FMT
);
797 fmt
= _NL_CURRENT (LC_TIME
, D_T_FMT
);
799 if (!recursive (fmt
))
801 if (s
.decided
== loc
)
808 if (strcmp (fmt
, HERE_D_T_FMT
))
815 /* The C locale has no era information, so use the
816 normal representation. */
817 if (!recursive (HERE_D_T_FMT
))
822 if (s
.decided
!= raw
)
826 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
827 if (era
!= NULL
&& match_string (era
->era_name
, rp
))
836 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
837 _NL_TIME_ERA_NUM_ENTRIES
);
838 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
;
839 ++s
.era_cnt
, rp
= rp_backup
)
841 era
= _nl_select_era_entry (s
.era_cnt
843 if (era
!= NULL
&& match_string (era
->era_name
, rp
))
849 if (s
.era_cnt
!= (int) num_eras
)
853 if (s
.decided
== loc
)
858 /* The C locale has no era information, so use the
859 normal representation. */
862 if (s
.decided
!= raw
)
864 get_number(0, 9999, 4);
872 assert (s
.decided
== loc
);
874 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
878 int delta
= ((tm
->tm_year
- era
->offset
)
879 * era
->absolute_direction
);
881 && delta
< (((int64_t) era
->stop_date
[0]
882 - (int64_t) era
->start_date
[0])
883 * era
->absolute_direction
));
891 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
892 _NL_TIME_ERA_NUM_ENTRIES
);
893 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
; ++s
.era_cnt
)
895 era
= _nl_select_era_entry (s
.era_cnt
899 int delta
= ((tm
->tm_year
- era
->offset
)
900 * era
->absolute_direction
);
902 && delta
< (((int64_t) era
->stop_date
[0]
903 - (int64_t) era
->start_date
[0])
904 * era
->absolute_direction
))
911 if (s
.era_cnt
!= (int) num_eras
)
915 if (s
.decided
== loc
)
921 goto match_year_in_century
;
923 if (s
.decided
!= raw
)
925 num_eras
= _NL_CURRENT_WORD (LC_TIME
,
926 _NL_TIME_ERA_NUM_ENTRIES
);
927 for (s
.era_cnt
= 0; s
.era_cnt
< (int) num_eras
;
928 ++s
.era_cnt
, rp
= rp_backup
)
930 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
931 if (era
!= NULL
&& recursive (era
->era_format
))
934 if (s
.era_cnt
== (int) num_eras
)
937 if (s
.decided
== loc
)
950 get_number (0, 9999, 4);
951 tm
->tm_year
= val
- 1900;
956 if (s
.decided
!= raw
)
958 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_D_FMT
);
961 fmt
= _NL_CURRENT (LC_TIME
, D_FMT
);
963 if (!recursive (fmt
))
965 if (s
.decided
== loc
)
972 if (strcmp (fmt
, HERE_D_FMT
))
978 if (!recursive (HERE_D_FMT
))
982 if (s
.decided
!= raw
)
984 const char *fmt
= _NL_CURRENT (LC_TIME
, ERA_T_FMT
);
987 fmt
= _NL_CURRENT (LC_TIME
, T_FMT
);
989 if (!recursive (fmt
))
991 if (s
.decided
== loc
)
998 if (strcmp (fmt
, HERE_T_FMT
))
1004 if (!recursive (HERE_T_FMT
))
1012 /* We have no information about the era format. Just use
1013 the normal format. */
1014 if (*fmt
!= 'c' && *fmt
!= 'C' && *fmt
!= 'y' && *fmt
!= 'Y'
1015 && *fmt
!= 'x' && *fmt
!= 'X')
1016 /* This is an illegal format. */
1026 /* Match day of month using alternate numeric symbols. */
1027 get_alt_number (1, 31, 2);
1033 /* Match hour in 24-hour clock using alternate numeric
1035 get_alt_number (0, 23, 2);
1040 /* Match hour in 12-hour clock using alternate numeric
1042 get_alt_number (1, 12, 2);
1043 tm
->tm_hour
= val
% 12;
1047 /* Match month using alternate numeric symbols. */
1048 get_alt_number (1, 12, 2);
1049 tm
->tm_mon
= val
- 1;
1054 /* Match minutes using alternate numeric symbols. */
1055 get_alt_number (0, 59, 2);
1059 /* Match seconds using alternate numeric symbols. */
1060 get_alt_number (0, 61, 2);
1064 get_alt_number (0, 53, 2);
1069 get_alt_number (0, 53, 2);
1074 get_alt_number (0, 53, 2);
1075 /* XXX This cannot determine any field in TM without
1076 further information. */
1079 /* Match number of weekday using alternate numeric symbols. */
1080 get_alt_number (0, 6, 1);
1085 /* Match year within century using alternate numeric symbols. */
1086 get_alt_number (0, 99, 2);
1087 tm
->tm_year
= val
>= 69 ? val
: val
+ 100;
1101 /* Recursive invocation, returning success, so
1102 update parent's struct tm and state. */
1103 *(struct __strptime_state
*) statep
= s
;
1108 if (s
.have_I
&& s
.is_pm
)
1111 if (s
.century
!= -1)
1114 tm
->tm_year
= tm
->tm_year
% 100 + (s
.century
- 19) * 100;
1116 /* Only the century, but not the year. Strange, but so be it. */
1117 tm
->tm_year
= (s
.century
- 19) * 100;
1120 if (s
.era_cnt
!= -1)
1122 era
= _nl_select_era_entry (s
.era_cnt HELPER_LOCALE_ARG
);
1126 tm
->tm_year
= (era
->start_date
[0]
1127 + ((tm
->tm_year
- era
->offset
)
1128 * era
->absolute_direction
));
1130 /* Era start year assumed. */
1131 tm
->tm_year
= era
->start_date
[0];
1136 /* No era found but we have seen an E modifier. Rectify some
1138 if (s
.want_century
&& s
.century
== -1 && tm
->tm_year
< 69)
1142 if (s
.want_xday
&& !s
.have_wday
)
1144 if ( !(s
.have_mon
&& s
.have_mday
) && s
.have_yday
)
1146 /* We don't have tm_mon and/or tm_mday, compute them. */
1148 while (__mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
] <= tm
->tm_yday
)
1151 tm
->tm_mon
= t_mon
- 1;
1155 - __mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
- 1] + 1);
1159 /* Don't crash in day_of_the_week if tm_mon is uninitialized. */
1160 if (s
.have_mon
|| (unsigned) tm
->tm_mon
<= 11)
1161 day_of_the_week (tm
);
1164 if (s
.want_xday
&& !s
.have_yday
&& (s
.have_mon
|| (unsigned) tm
->tm_mon
<= 11))
1165 day_of_the_year (tm
);
1167 if ((s
.have_uweek
|| s
.have_wweek
) && s
.have_wday
)
1169 int save_wday
= tm
->tm_wday
;
1170 int save_mday
= tm
->tm_mday
;
1171 int save_mon
= tm
->tm_mon
;
1172 int w_offset
= s
.have_uweek
? 0 : 1;
1176 day_of_the_week (tm
);
1178 tm
->tm_mday
= save_mday
;
1180 tm
->tm_mon
= save_mon
;
1183 tm
->tm_yday
= ((7 - (tm
->tm_wday
- w_offset
)) % 7
1184 + (s
.week_no
- 1) * 7
1185 + (save_wday
- w_offset
+ 7) % 7);
1187 if (!s
.have_mday
|| !s
.have_mon
)
1190 while (__mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
]
1194 tm
->tm_mon
= t_mon
- 1;
1198 - __mon_yday
[__isleap(1900 + tm
->tm_year
)][t_mon
- 1] + 1);
1201 tm
->tm_wday
= save_wday
;
1209 strptime (buf
, format
, tm LOCALE_PARAM
)
1215 return __strptime_internal (buf
, format
, tm
, NULL LOCALE_ARG
);
1219 weak_alias (__strptime_l
, strptime_l
)