diff options
author | blhsing <blhsing@gmail.com> | 2024-08-23 15:45:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 15:45:03 (GMT) |
commit | 126910edba812a01794f307b0cfa2a7f02bda190 (patch) | |
tree | e86e74c3e38f2b8cfcbe9484dc696a0c52767a3f /configure.ac | |
parent | 7cd3aa42f0cf72bf9a214e2630850879fe078377 (diff) | |
download | cpython-126910edba812a01794f307b0cfa2a7f02bda190.zip cpython-126910edba812a01794f307b0cfa2a7f02bda190.tar.gz cpython-126910edba812a01794f307b0cfa2a7f02bda190.tar.bz2 |
gh-122272: Guarantee specifiers %F and %C for datetime.strftime to be 0-padded (GH-122436)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 9daace7..3c1dc1c 100644 --- a/configure.ac +++ b/configure.ac @@ -6703,6 +6703,34 @@ then [Define if year with century should be normalized for strftime.]) fi +AC_CACHE_CHECK([whether C99-specific strftime specifiers are supported], [ac_cv_strftime_c99_support], [ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <time.h> +#include <string.h> + +int main(void) +{ + char full_date[11]; + struct tm date = { + .tm_year = 0, + .tm_mon = 0, + .tm_mday = 1 + }; + if (strftime(full_date, sizeof(full_date), "%F", &date) && !strcmp(full_date, "1900-01-01")) { + return 0; + } + return 1; +} +]])], +[ac_cv_strftime_c99_support=yes], +[ac_cv_strftime_c99_support=no], +[ac_cv_strftime_c99_support=no])]) +if test "$ac_cv_strftime_c99_support" = yes +then + AC_DEFINE([Py_STRFTIME_C99_SUPPORT], [1], + [Define if C99-specific strftime specifiers are supported.]) +fi + dnl check for ncursesw/ncurses and panelw/panel dnl NOTE: old curses is not detected. dnl have_curses=[no, yes] |