mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.13] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121144)
(cherry picked from commit 6d34938dc8
)
Co-authored-by: blhsing <blhsing@gmail.com>
This commit is contained in:
parent
cbbd95328d
commit
009618f112
7 changed files with 174 additions and 16 deletions
28
configure.ac
28
configure.ac
|
@ -6567,6 +6567,34 @@ then
|
|||
[Define if you have struct stat.st_mtimensec])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether year with century should be normalized for strftime], [ac_cv_normalize_century], [
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char year[5];
|
||||
struct tm date = {
|
||||
.tm_year = -1801,
|
||||
.tm_mon = 0,
|
||||
.tm_mday = 1
|
||||
};
|
||||
if (strftime(year, sizeof(year), "%Y", &date) && !strcmp(year, "0099")) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[ac_cv_normalize_century=yes],
|
||||
[ac_cv_normalize_century=no],
|
||||
[ac_cv_normalize_century=yes])])
|
||||
if test "$ac_cv_normalize_century" = yes
|
||||
then
|
||||
AC_DEFINE([Py_NORMALIZE_CENTURY], [1],
|
||||
[Define if year with century should be normalized for strftime.])
|
||||
fi
|
||||
|
||||
dnl check for ncurses/ncursesw and panel/panelw
|
||||
dnl NOTE: old curses is not detected.
|
||||
dnl have_curses=[no, ncursesw, ncurses]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue