Hello co_monks,
I'm a bit puzzeled about the behaviour of different versions of strftime. I got the following code:
use strict;
use POSIX qw(strftime);
print "Perl: $]\n";
print "POSIX: $POSIX::VERSION\n";
my $today = strftime("%d %m %Y %H:%M:%S", gmtime(time));
print 'scalar gmtime: ', scalar gmtime(time), "\n";
print "strftime'd gmtime: $today\n";
$today = strftime("%d %m %Y %H:%M:%S", localtime(time));
print 'scalar localtime: ', scalar localtime(time), "\n";
print "strftime'd localtime: $today\n";
Depending on what Perl version (and POSIX version) I use I get different output for gmtime.
Perl: 5.00503
POSIX: 1.02
scalar gmtime: Tue Jun 14 12:18:04 2005
strftime'd gmtime: 14 06 2005 13:18:04
scalar localtime: Tue Jun 14 14:18:04 2005
strftime'd localtime: 14 06 2005 14:18:04
Perl: 5.008006
POSIX: 1.08
scalar gmtime: Tue Jun 14 12:18:04 2005
strftime'd gmtime: 14 06 2005 12:18:04
scalar localtime: Tue Jun 14 14:18:04 2005
strftime'd localtime: 14 06 2005 14:18:04
Any hints about that? And b.t.w. '12:18:04' is the correct GMT.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|