From: Steve Peters Date: Sat, 26 Nov 2005 02:32:10 +0000 (+0000) Subject: Hmmm...strftime() does work on Win32, but tzset() is having problems X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34dd738f0e7d53b99c5f6225cfd5603222c0660a;p=p5sagit%2Fp5-mst-13.2.git Hmmm...strftime() does work on Win32, but tzset() is having problems on OpenBSD. p4raw-id: //depot/perl@26207 --- diff --git a/ext/POSIX/t/time.t b/ext/POSIX/t/time.t index 8b30415..6604463 100644 --- a/ext/POSIX/t/time.t +++ b/ext/POSIX/t/time.t @@ -18,7 +18,8 @@ SKIP: { # seems ambiguous skip "No tzset()", 2 if $^O eq "MacOS" || $^O eq "VMS" || $^O eq "cygwin" || - $^O eq "MSWin32" || $^O eq "dos" || $^O eq "interix"; + $^O eq "MSWin32" || $^O eq "dos" || $^O eq "interix" || + $^O eq "openbsd"; tzset(); my @tzname = tzname(); like($tzname[0], qr/[GMT|UTC]/i, "tzset() to GMT/UTC"); @@ -32,13 +33,15 @@ is(asctime(localtime(0)), ctime(0), "asctime() and ctime() at zero"); is(asctime(localtime(12345678)), ctime(12345678), "asctime() and ctime() at 12345678"); # Careful! strftime() is locale sensative. Let's take care of that -SKIP: { - skip "Win32's is missing a %e" if $^O eq "MSWin32"; - my $orig_loc = setlocale(LC_TIME, "C") || die "Cannot setlocale() to C: $!"; - is(ctime(86400), strftime("%a %b %e %H:%M:%S %Y\n", localtime(86400)), +my $orig_loc = setlocale(LC_TIME, "C") || die "Cannot setlocale() to C: $!"; +if ($^O eq "MSWin32") { + is(ctime(0), strftime("%a %b %#d %H:%M:%S %Y\n", localtime(0)), + "get ctime() equal to strftime()"); +} else { + is(ctime(0), strftime("%a %b %e %H:%M:%S %Y\n", localtime(0)), "get ctime() equal to strftime()"); - setlocale(LC_TIME, $orig_loc) || die "Cannot setlocale() back to orig: $!"; } +setlocale(LC_TIME, $orig_loc) || die "Cannot setlocale() back to orig: $!"; # Hard to test other than to make sure it returns something numeric and < 0 like(clock(), qr/\d*/, "clock() returns a numeric value");