Skip to content

Change in output of strftime from v5.40 to v5.42 #23878

@simcop2387

Description

@simcop2387

Module: POSIX

Description
Reported on IRC by sphex, it looks like there's a change in behavior of POSIX::strftime between v5.40..v5.42

sphex: anyone else seeing a different (incorrect) result on 5.42 than on 5.40 with: TZ=Europe/Paris perl -E 'use POSIX "strftime"; say strftime("%FT%T%z", localtime 1761436800);'

Steps to Reproduce
5.42:
perl -E 'BEGIN {$ENV{TZ}="Europe/Paris"} use POSIX "strftime"; say strftime("%FT%T%z", localtime 1761436800);'
2025-10-26T02:00:00+0100

5.40
perl -E 'BEGIN {$ENV{TZ}="Europe/Paris"} use POSIX "strftime"; say strftime("%FT%T%z", localtime 1761436800);'
2025-10-26T02:00:00+0200

Expected behavior
I believe the answer from 5.40 is the correct output.

I bisected this with the following command:

Porting/bisect.pl --start v5.40.0 --end v5.42.0 -e ' BEGIN {$ENV{TZ}="Europe/Paris"} use POSIX "strftime"; die "Wrong time" unless "2025-10-26T02:00:00+0200" eq strftime("%FT%T%z", localtime 1761436800);'

and got: commit 86a9c18 as the culprit
Perl configuration

Summary of my perl5 (revision 5 version 42 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=6.12.22+bpo-amd64
    archname=x86_64-linux
    uname='linux simcop2387.info 6.12.22+bpo-amd64 #1 smp preempt_dynamic debian 6.12.22-1~bpo12+1 (2025-04-25) x86_64 gnulinux '
    config_args='-Dprefix=/home/perlbot/perl5/custom/5.42.0 -de -Dusedevel -Duseshrplib -Dusemymalloc=y -Accflags=-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb  -DPERL_EMERGENCY_SBRK -Aldflags=-Wl,-z,now -Wl,-zrelro -Wl,-z,noexecstack -A'eval:scriptdir=/home/perlbot/perl5/custom/5.42.0/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=y
    default_inc_excludes_dot=define

  Compiler:
    cc='cc'
    ccflags ='-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb -DPERL_EMERGENCY_SBRK -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-O2'
    cppflags='-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb -DPERL_EMERGENCY_SBRK -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='12.2.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -Wl,-z,now -Wl,-zrelro -Wl,-z,noexecstack -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/lib/x86_64-linux-gnu/libc.so.6
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version='2.36'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E -Wl,-rpath,/home/perlbot/perl5/custom/5.42.0/lib/5.42.0/x86_64-linux/CORE'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    MYMALLOC
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at Jul  3 2025 21:14:07
  %ENV:
    PERLBREW_HOME="/home/perlbot/.perlbrew"
    PERLBREW_MANPATH="/home/perlbot/perl5/perlbrew/perls/perlbot-main/man"
    PERLBREW_PATH="/home/perlbot/perl5/perlbrew/bin:/home/perlbot/perl5/perlbrew/perls/perlbot-main/bin"
    PERLBREW_PERL="perlbot-main"
    PERLBREW_ROOT="/home/perlbot/perl5/perlbrew"
    PERLBREW_SHELLRC_VERSION="0.86"
    PERLBREW_VERSION="0.86"
  @INC:
    /home/perlbot/perl5/custom/5.42.0/lib/site_perl/5.42.0/x86_64-linux
    /home/perlbot/perl5/custom/5.42.0/lib/site_perl/5.42.0
    /home/perlbot/perl5/custom/5.42.0/lib/5.42.0/x86_64-linux
    /home/perlbot/perl5/custom/5.42.0/lib/5.42.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions