@@ -8356,7 +8356,12 @@ Perl_sv_strftime_ints(pTHX_ SV * fmt, int sec, int min, int hour,
83568356#endif
83578357
83588358 struct tm mytm ;
8359+ time_t then = 1741510800 - 1 ;
8360+ mytm = * localtime (& then );
8361+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "sv_strftime_ints: Calling ints_to_tm: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , sec , min , hour , mday , mon , year , isdst ));
83598362 ints_to_tm (& mytm , locale , sec , min , hour , mday , mon , year , isdst );
8363+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Return from ints_to_tm: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm .tm_sec , mytm .tm_min , mytm .tm_hour , mytm .tm_mday , mytm .tm_mon , mytm .tm_year , mytm .tm_isdst ));
8364+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Calling sv_strftime_common\n" ));
83608365 return sv_strftime_common (fmt , locale , & mytm );
83618366}
83628367
@@ -8398,6 +8403,7 @@ S_sv_strftime_common(pTHX_ SV * fmt,
83988403 * having to realloc; this is a somewhat educated guess, but feel free to
83998404 * tweak it. */
84008405 SV * sv = newSVpvz (MAX (fmt_cur * 2 , 64 ));
8406+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Calling strftime8\n" ));
84018407 if (! strftime8 (fmt_str ,
84028408 sv ,
84038409 locale ,
@@ -8413,6 +8419,7 @@ S_sv_strftime_common(pTHX_ SV * fmt,
84138419 if (result_utf8ness == UTF8NESS_YES ) {
84148420 SvUTF8_on (sv );
84158421 }
8422+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "return from strftime8\n" ));
84168423
84178424 return sv ;
84188425}
@@ -8440,14 +8447,17 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
84408447 mytm -> tm_year = year ;
84418448
84428449 struct tm * which_tm = mytm ;
8450+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "ints_to_tm entry: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
84438451
84448452#ifndef HAS_MKTIME
84458453
84468454 mini_mktime (mytm );
8455+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Doesn't have mktime\n" ));
84478456
84488457#else
84498458# if defined(HAS_TM_TM_GMTOFF ) || defined(HAS_TM_TM_ZONE )
84508459# define ALWAYS_RUN_MKTIME
8460+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "always run mktime\n" ));
84518461
84528462 struct tm aux_tm ;
84538463
@@ -8462,7 +8472,9 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
84628472 * this; they always consider the possibility of dst. But mini_mktime()
84638473 * never considers dst, so use it under this condition. */
84648474 if (isdst == 0 ) {
8475+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Before mini_mktime: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
84658476 mini_mktime (mytm );
8477+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "After mini_mktime: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
84668478
84678479# ifdef ALWAYS_RUN_MKTIME
84688480
@@ -8490,7 +8502,9 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
84908502 /* Here, we need to run libc mktime(), either because we want to take
84918503 * dst into consideration, or because it calculates one or two fields
84928504 * that we need that mini_mktime() doesn't handle. */
8505+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Before setting isdst: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
84938506 which_tm -> tm_isdst = isdst ;
8507+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "After setting isdst: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
84948508
84958509 /* Unlike mini_mktime(), it does consider the locale, so have to switch
84968510 * to the correct one. */
@@ -8504,12 +8518,15 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
85048518
85058519 MKTIME_UNLOCK ;
85068520 restore_toggled_locale_c (LC_TIME , orig_TIME_locale );
8521+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "After mktime: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
85078522
85088523# ifndef ALWAYS_RUN_MKTIME
85098524
85108525 }
8526+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "Finished : tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
85118527
85128528# else
8529+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "About to set other fields : tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
85138530
85148531 /* And use the saved libc values for tm_gmtoff and tm_zone if we used an
85158532 * auxiliary struct to get them */
@@ -8528,6 +8545,7 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
85288545# undef ALWAYS_RUN_MKTIME
85298546#endif
85308547
8548+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "returning: tm_sec=%d, tm_min=%d, tm_hour=%d, tm_mday=%d, tm_mon=%d, tm_year=%d, isdst=%d\n" , mytm -> tm_sec , mytm -> tm_min , mytm -> tm_hour , mytm -> tm_mday , mytm -> tm_mon , mytm -> tm_year , mytm -> tm_isdst ));
85318549 return ;
85328550}
85338551
@@ -8538,6 +8556,7 @@ S_strftime_tm(pTHX_ const char *fmt,
85388556 const struct tm * mytm )
85398557{
85408558 PERL_ARGS_ASSERT_STRFTIME_TM ;
8559+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "entering strftime_tm\n" ));
85418560
85428561 /* Execute strftime() based on the input struct tm, and the current LC_TIME
85438562 * locale.
@@ -8613,6 +8632,7 @@ S_strftime_tm(pTHX_ const char *fmt,
86138632
86148633#else
86158634 STRFTIME_LOCK ;
8635+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "calling strftime\n" ));
86168636 Size_t len = strftime (buf , bufsize , fmt , mytm );
86178637 STRFTIME_UNLOCK ;
86188638#endif
@@ -8627,6 +8647,7 @@ S_strftime_tm(pTHX_ const char *fmt,
86278647 if (inRANGE (len , 1 , bufsize - 1 )) {
86288648 succeeded = true;
86298649 SvCUR_set (sv , len );
8650+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "strftime had enough room\n" ));
86308651 goto strftime_return ;
86318652 }
86328653
@@ -8695,6 +8716,7 @@ S_strftime8(pTHX_ const char * fmt,
86958716 const bool called_externally )
86968717{
86978718 PERL_ARGS_ASSERT_STRFTIME8 ;
8719+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "entering strftime8\n" ));
86988720
86998721 /* Wrap strftime_tm, taking into account the input and output UTF-8ness */
87008722
@@ -8714,9 +8736,11 @@ S_strftime8(pTHX_ const char * fmt,
87148736
87158737 switch (fmt_utf8ness ) {
87168738 case UTF8NESS_IMMATERIAL :
8739+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "immaterial\n" ));
87178740 break ;
87188741
87198742 case UTF8NESS_NO : /* Known not to be UTF-8; must not be UTF-8 locale */
8743+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "calling is_locale_utf8\n" ));
87208744 if (is_locale_utf8 (locale )) {
87218745 SET_EINVAL ;
87228746 return false;
@@ -8727,6 +8751,7 @@ S_strftime8(pTHX_ const char * fmt,
87278751
87288752 case UTF8NESS_YES : /* Known to be UTF-8; must be UTF-8 locale if can't
87298753 downgrade. */
8754+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "calling is_locale_utf8\n" ));
87308755 if (is_locale_utf8 (locale )) {
87318756 locale_utf8ness = LOCALE_IS_UTF8 ;
87328757 }
@@ -8744,6 +8769,7 @@ S_strftime8(pTHX_ const char * fmt,
87448769 break ;
87458770
87468771 case UTF8NESS_UNKNOWN :
8772+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "calling is_locale_utf8\n" ));
87478773 if (! is_locale_utf8 (locale )) {
87488774 locale_utf8ness = LOCALE_NOT_UTF8 ;
87498775 }
@@ -8765,6 +8791,7 @@ S_strftime8(pTHX_ const char * fmt,
87658791 break ;
87668792 }
87678793
8794+ DEBUG_Lv (PerlIO_printf (Perl_debug_log , "calling strftime_tm\n" ));
87688795 if (! strftime_tm (fmt , sv , locale , mytm )) {
87698796 Safefree (free_me );
87708797 return false;
0 commit comments