Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c1f67a

Browse files
committed
Exercise POSIX::strftime fix per GH Perl#22369
Needed for GH Perl#22351
1 parent fdb68ce commit 6c1f67a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ext/POSIX/t/time.t

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use strict;
99

1010
use Config;
1111
use POSIX;
12-
use Test::More tests => 26;
12+
use Test::More tests => 27;
1313

1414
# For the first go to UTC to avoid DST issues around the world when testing. SUS3 says that
1515
# null should get you UTC, but some environments want the explicit names.
@@ -205,3 +205,18 @@ SKIP: {
205205
is(mktime(CORE::localtime($time)), $time, "mktime()");
206206
is(mktime(POSIX::localtime($time)), $time, "mktime()");
207207
}
208+
209+
SKIP: { # XXX: Improve this test!
210+
skip "System 'date' command not tested on all OSes yet", 1
211+
unless ($^O eq 'linux' or $^O eq 'freebsd' or $^O eq 'openbsd');
212+
my $xdate = `date '+%s'`;
213+
chomp $xdate;
214+
my $posix_strftime = POSIX::strftime('%s', localtime);
215+
my $perl_time = time;
216+
ok(
217+
($posix_strftime == $xdate) &&
218+
($posix_strftime == $perl_time),
219+
'GH #22351; pr: GH #22369'
220+
);
221+
}
222+

0 commit comments

Comments
 (0)