@@ -8190,17 +8190,16 @@ The value of C<isdst> is used as follows:
81908190
81918191=item 0
81928192
8193- No daylight savings time is in effect
8193+ The caller knows that daylight savings time is not in effect
81948194
81958195=item E<gt>0
81968196
8197- Check if daylight savings time is in effect, and adjust the results
8198- accordingly .
8197+ The caller knows that daylight savings time is in effect, though the
8198+ underlying libc function may choose to override this .
81998199
82008200=item E<lt>0
82018201
8202- This value is reserved for internal use by the L<POSIX> module for backwards
8203- compatibility purposes.
8202+ The function is to calculate itself if daylight savings time is in effect.
82048203
82058204=back
82068205
@@ -8269,15 +8268,8 @@ Perl_sv_strftime_ints(pTHX_ SV * fmt, int sec, int min, int hour,
82698268 const char * locale = "C" ;
82708269#endif
82718270
8272- /* A negative 'isdst' triggers backwards compatibility mode for
8273- * POSIX::strftime(), in which 0 is always passed to ints_to_tm() so that
8274- * the possibility of daylight savings time is never considered, But, a 1
8275- * is eventually passed to libc strftime() so that it returns the results
8276- * it always has for a non-zero 'isdst'. See GH #22351 */
82778271 struct tm mytm ;
8278- ints_to_tm (& mytm , locale , sec , min , hour , mday , mon , year ,
8279- MAX (0 , isdst ));
8280- mytm .tm_isdst = MIN (1 , abs (isdst ));
8272+ ints_to_tm (& mytm , locale , sec , min , hour , mday , mon , year , isdst );
82818273 return sv_strftime_common (fmt , locale , & mytm );
82828274}
82838275
@@ -8383,30 +8375,34 @@ S_ints_to_tm(pTHX_ struct tm * mytm,
83838375 if (isdst == 0 ) {
83848376 mini_mktime (mytm );
83858377
8386- # ifndef ALWAYS_RUN_MKTIME
8387-
8388- /* When we don't always need libc mktime(), we call it only when we didn't
8389- * call mini_mktime() */
8390- } else {
8378+ # ifdef ALWAYS_RUN_MKTIME
83918379
8392- # else
83938380 /* Here will have to run libc mktime() in order to get the values of
83948381 * some fields that mini_mktime doesn't populate. We don't want
8395- * mktime's side effect of looking for dst, so we have to have a
8396- * separate tm structure from which we copy just those fields into the
8397- * returned structure. Initialize its values. mytm should now be a
8398- * normalized version of the input . */
8382+ * mktime's side effect of looking for dst (because isdst==0) , so we
8383+ * have to have a separate tm structure from which we copy just those
8384+ * fields into the structure we return . Initialize its values, which
8385+ * have now been normalized by mini_mktime . */
83998386 aux_tm = * mytm ;
8400- aux_tm .tm_isdst = isdst ;
84018387 which_tm = & aux_tm ;
84028388
84038389# endif
84048390
8391+ }
8392+
8393+ # ifndef ALWAYS_RUN_MKTIME
8394+
8395+ else /* Don't run libc mktime if both: we ran mini_mktime above, and we
8396+ don't have to always run libc mktime */
8397+
8398+ # endif
8399+
8400+ {
84058401 /* Here, we need to run libc mktime(), either because we want to take
84068402 * dst into consideration, or because it calculates one or two fields
8407- * that we need that mini_mktime() doesn't handle.
8408- *
8409- * Unlike mini_mktime(), it does consider the locale, so have to switch
8403+ * that we need that mini_mktime() doesn't handle. */
8404+
8405+ / * Unlike mini_mktime(), it does consider the locale, so have to switch
84108406 * to the correct one. */
84118407 const char * orig_TIME_locale = toggle_locale_c (LC_TIME , locale );
84128408 MKTIME_LOCK ;
0 commit comments