Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

POSIX::strftime with gmtime

by pelagic (Priest)
on Jun 14, 2005 at 12:21 UTC ( [id://466503]=perlquestion: print w/replies, xml ) Need Help??

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:
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://466503]
Approved by Tanalis
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found