Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

POSIX::strftime with gmtime

by pelagic (Curate)
on Jun 14, 2005 at 12:21 UTC ( #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

Comment on POSIX::strftime with gmtime
Select or Download Code
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
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? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2015-07-31 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (277 votes), past polls