Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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
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 drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-07-12 02:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls