Description
b277e76 was introduced to fix a long-standing problem with Daylight Savings Time on Win32 (#6080). The fix was successful in some combinations of time and time zone, but introduced problems in others. These symptoms are seen in the time zones shown with perl 5.32.0 and 5.34.0 on Windows 10:
Steps to Reproduce
The following code in three files:
stat_test.pl
my $mtime = 0;
utime $mtime, $mtime, 'stat_test.pl';
printf "%s\n", scalar gmtime ((stat 'stat_test.pl')[9]);
stat_test.bat
@echo off
tzutil /s "UTC"
echo (UTC) Co-ordinated Universal Time
call sub.bat
tzutil /s "Greenland Standard Time"
echo (UTC-03:00) Greenland
call sub.bat
tzutil /s "E. South America Standard Time"
echo (UTC-03:00) Brasilia
call sub.bat
tzutil /s "Turkey Standard Time"
echo (UTC+03:00) Istanbul
call sub.bat
tzutil /s "E. Australia Standard Time"
echo (UTC+10:00) Brisbane
call sub.bat
sub.bat
@echo off
echo | set /p="5.32: "
5.32\perl-5.32.0\perl stat_test.pl
echo | set /p="5.34: "
5.34\perl-5.34.0\perl stat_test.pl
echo --------------------------------
Observed behavior
(UTC) Co-ordinated Universal Time
5.32: Thu Jan 1 00:00:00 1970
5.34: Thu Jan 1 00:00:00 1970
--------------------------------
(UTC-03:00) Greenland
5.32: Wed Dec 31 23:59:59 1969
5.34: Thu Jan 1 00:00:00 1970
--------------------------------
(UTC-03:00) Brasilia
5.32: Wed Dec 31 23:59:59 1969
5.34: Thu Jan 1 01:00:00 1970
--------------------------------
(UTC+03:00) Istanbul
5.32: Thu Jan 1 00:00:00 1970
5.34: Wed Dec 31 23:59:59 1969
--------------------------------
(UTC+10:00) Brisbane
5.32: Thu Jan 1 00:00:00 1970
5.34: Thu Jan 1 00:00:00 1970
--------------------------------
When the variable $mtime is changed like this:
my $mtime = 10957 * 24 * 60 * 60;
the observed output is:
(UTC) Co-ordinated Universal Time
5.32: Sat Jan 1 00:00:00 2000
5.34: Sat Jan 1 00:00:00 2000
--------------------------------
(UTC-03:00) Greenland
5.32: Sat Jan 1 00:00:00 2000
5.34: Sat Jan 1 00:00:00 2000
--------------------------------
(UTC-03:00) Brasilia
5.32: Sat Jan 1 00:00:00 2000
5.34: Sat Jan 1 01:00:00 2000
--------------------------------
(UTC+03:00) Istanbul
5.32: Sat Jan 1 00:00:00 2000
5.34: Fri Dec 31 23:00:00 1999
--------------------------------
(UTC+10:00) Brisbane
5.32: Sat Jan 1 00:00:00 2000
5.34: Sat Jan 1 00:00:00 2000
--------------------------------
Expected behavior
5.32: Thu Jan 1 00:00:00 1970
5.34: Thu Jan 1 00:00:00 1970
and
5.32: Sat Jan 1 00:00:00 2000
5.34: Sat Jan 1 00:00:00 2000
Perl configuration
Summary of my perl5 (revision 5 version 36 subversion 0) configuration:
Platform:
osname=MSWin32
osvers=10.0.19044.1826
archname=MSWin32-x64-multi-thread
uname=''
config_args='undef'
hint=recommended
useposix=true
d_sigaction=undef
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='gcc'
ccflags =' -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields'
optimize='-O2'
cppflags='-DWIN32'
ccversion=''
gccversion='8.3.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='long long'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags ='-s -L"C:\Users\Glenn\Apps\Strawberry\perl\lib\CORE" -L"C:\Users\Glenn\Apps\Strawberry\c\lib" -L"C:\Users\Glenn\Apps\Strawberry\c\x86_64-w64-mingw32\lib" -L"C:\Users\Glenn\Apps\Strawberry\c\lib\gcc\x86_64-w64-mingw32\8.3.0"'
libpth=C:\Users\Glenn\Apps\Strawberry\c\lib C:\Users\Glenn\Apps\Strawberry\c\x86_64-w64-mingw32\lib C:\Users\Glenn\Apps\Strawberry\c\lib\gcc\x86_64-w64-mingw32\8.3.0
libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=
so=dll
useshrplib=true
libperl=libperl536.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs
dlext=dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags='-shared -s -L"C:\Users\Glenn\Apps\Strawberry\perl\lib\CORE" -L"C:\Users\Glenn\Apps\Strawberry\c\lib" -L"C:\Users\Glenn\Apps\Strawberry\c\x86_64-w64-mingw32\lib" -L"C:\Users\Glenn\Apps\Strawberry\c\lib\gcc\x86_64-w64-mingw32\8.3.0"'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
HAVE_INTERP_INTERN
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under MSWin32
Compiled at Jul 17 2022 15:30:54
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4