diff options
Diffstat (limited to 'win32/strptime.c')
-rw-r--r-- | win32/strptime.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/win32/strptime.c b/win32/strptime.c index 3205b95a2..c12e96202 100644 --- a/win32/strptime.c +++ b/win32/strptime.c | |||
@@ -1,23 +1,23 @@ | |||
1 | /* Copyright (C) 2002, 2004-2005, 2007, 2009-2020 Free Software Foundation, | 1 | /* Copyright (C) 2002, 2004-2005, 2007, 2009-2024 Free Software Foundation, |
2 | Inc. | 2 | Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU Lesser General Public License as |
7 | the Free Software Foundation; either version 2, or (at your option) | 7 | published by the Free Software Foundation; either version 2.1 of the |
8 | any later version. | 8 | License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This file is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along | 15 | You should have received a copy of the GNU Lesser General Public License |
16 | with this program; if not, see <https://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * File from gnulib (https://www.gnu.org/software/gnulib/), processed with | 19 | * File from gnulib (https://www.gnu.org/software/gnulib/), processed with |
20 | * coan source -U_LIBC -U_NL_CURRENT -UHAVE_TM_GMTOFF strptime.c | 20 | * coan source -U_LIBC -U_NL_CURRENT -UHAVE_STRUCT_TM_TM_GMTOFF strptime.c |
21 | * and lightly edited. | 21 | * and lightly edited. |
22 | * | 22 | * |
23 | * A form of support for tm_gmtoff was later restored. | 23 | * A form of support for tm_gmtoff was later restored. |
@@ -30,7 +30,7 @@ | |||
30 | #include <ctype.h> | 30 | #include <ctype.h> |
31 | #include <limits.h> | 31 | #include <limits.h> |
32 | #include <string.h> | 32 | #include <string.h> |
33 | #include <stdbool.h> | 33 | #include <strings.h> |
34 | 34 | ||
35 | 35 | ||
36 | enum ptime_locale_status { not, loc, raw }; | 36 | enum ptime_locale_status { not, loc, raw }; |
@@ -543,23 +543,23 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tm, | |||
543 | 543 | ||
544 | if ((have_uweek || have_wweek) && have_wday) | 544 | if ((have_uweek || have_wweek) && have_wday) |
545 | { | 545 | { |
546 | int save_wday = tm->tm_wday; | 546 | int saved_wday = tm->tm_wday; |
547 | int save_mday = tm->tm_mday; | 547 | int saved_mday = tm->tm_mday; |
548 | int save_mon = tm->tm_mon; | 548 | int saved_mon = tm->tm_mon; |
549 | int w_offset = have_uweek ? 0 : 1; | 549 | int w_offset = have_uweek ? 0 : 1; |
550 | 550 | ||
551 | tm->tm_mday = 1; | 551 | tm->tm_mday = 1; |
552 | tm->tm_mon = 0; | 552 | tm->tm_mon = 0; |
553 | day_of_the_week (tm); | 553 | day_of_the_week (tm); |
554 | if (have_mday) | 554 | if (have_mday) |
555 | tm->tm_mday = save_mday; | 555 | tm->tm_mday = saved_mday; |
556 | if (have_mon) | 556 | if (have_mon) |
557 | tm->tm_mon = save_mon; | 557 | tm->tm_mon = saved_mon; |
558 | 558 | ||
559 | if (!have_yday) | 559 | if (!have_yday) |
560 | tm->tm_yday = ((7 - (tm->tm_wday - w_offset)) % 7 | 560 | tm->tm_yday = ((7 - (tm->tm_wday - w_offset)) % 7 |
561 | + (week_no - 1) *7 | 561 | + (week_no - 1) *7 |
562 | + save_wday - w_offset); | 562 | + saved_wday - w_offset); |
563 | 563 | ||
564 | if (!have_mday || !have_mon) | 564 | if (!have_mday || !have_mon) |
565 | { | 565 | { |
@@ -575,7 +575,7 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tm, | |||
575 | - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1); | 575 | - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1); |
576 | } | 576 | } |
577 | 577 | ||
578 | tm->tm_wday = save_wday; | 578 | tm->tm_wday = saved_wday; |
579 | } | 579 | } |
580 | 580 | ||
581 | return (char *) rp; | 581 | return (char *) rp; |