rovf has asked for the wisdom of the Perl Monks concerning the following question:

use warnings; use POSIX qw(strftime); print strftime("%d %e",localtime(time));
The above code prints 10 10 when run on Solaris, but 10 when run on Windows (ActiveState Perl). %e is not recognized on Windows. Any idea why?

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re: strftime Windows/Solaris compatibility question
by andreas1234567 (Vicar) on Sep 10, 2008 at 13:57 UTC
    POSIX strftime:
    strftime: If you want your code to be portable, your format ("fmt") argument should use only the conversion specifiers defined by the ANSI C standard (C89, to play safe). These are aAbBcdHIjmMpSUwWxXyYZ%. But even then, the results of some of the conversion specifiers are non-portable.
    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

      Thanks a lot! So I will stick to the %d.

      -- 
      Ronald Fischer <ynnor@mm.st>
Re: strftime Windows/Solaris compatibility question
by derby (Abbot) on Sep 10, 2008 at 13:45 UTC
Re: strftime Windows/Solaris compatibility question
by broomduster (Priest) on Sep 10, 2008 at 13:48 UTC
Re: strftime Windows/Solaris compatibility question
by syphilis (Archbishop) on Sep 10, 2008 at 13:55 UTC
    but 10 when run on Windows (ActiveState Perl)

    Prints %d %e for me on Windows (Vista) with both builds 824 (5.8.8) and 1004 (5.10.0) of ActivePerl.

    Cheers,
    Rob

      Huh? Must be a Vista thing then because it doesn't for me on XP. This good be the one (and only?) reason to prefer Vista to XP:-)

      Cheers
      dHarry

        Newer C-runtime ( MSVCR*.dll)
Re: strftime Windows/Solaris compatibility question
by dHarry (Abbot) on Sep 10, 2008 at 13:58 UTC

    See POSIX. The "If you want your code to be portable... " part in the strftime section.