pelagic has asked for the wisdom of the Perl Monks concerning the following question:
Hello co_monks,
I'm a bit puzzeled about the behaviour of different versions of strftime. I got the following code:
Depending on what Perl version (and POSIX version) I use I get different output for gmtime.
Any hints about that? And b.t.w. '12:18:04' is the correct GMT.
pelagic
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.
pelagic
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: POSIX::strftime with gmtime
by merlyn (Sage) on Jun 14, 2005 at 12:27 UTC |
Back to
Seekers of Perl Wisdom