Perl

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Change 26207: Hmmm...strftime() does work on Win32, but tzset() is having problems

    0 answers - 1889 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Change 26207 by stevep@stevep-mccoy on 2005/11/26 02:32:10
    Hmmmstrftime() does work on Win32, but tzset() is having problems
    on BSD.
    Affected files
    //depot/perl/ext/PSIX/t/time.t#2 edit
    Differences
    //depot/perl/ext/PSIX/t/time.t#2 (text)
    Index: perl/ext/PSIX/t/time.t
    perl/ext/PSIX/t/time.t#1~26206~Fri Nov 25 17:31:24 2005
    perl/ext/PSIX/t/time.tFri Nov 25 18:32:10 2005
    @@ -18,7 +18,8 @@
    # seems ambiguous
    skip "No tzset()", 2
    if $^ eq "MS" || $^ eq "VMS" || $^ eq "cygwin" ||
    - $^ eq "MSWin32" || $^ eq "dos" || $^ eq "interix";
    + $^ eq "MSWin32" || $^ eq "dos" || $^ eq "interix" ||
    + $^ eq "openbsd";
    tzset();
    my @tzname = tzname();
    like($tzname[0], qr/[GMT|UTC]/i, "tzset() to GMT/UTC");
    @@ -32,13 +33,15 @@
    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 $^ 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 ($^ 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");
    End of Patch.

Re: Change 26207: Hmmm...strftime() does work on Win32, but tzset() is having problems


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Perl"

EMSDN.COM