Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Newbie: Request help on creating CSV using timestamp data

by Tux (Canon)
on Nov 25, 2013 at 11:57 UTC ( [id://1064215]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Newbie: Request help on creating CSV using timestamp data
in thread Newbie: Request help on creating CSV using timestamp data

Is it possible that you are still using a module that overrides the builtin localtime function? I did mention that my example did use the builtin. (to be complete, I tested the same with use Time::Local; and use Time::Piece;, and both passed too).

I ran my piece of example code through every version of perl ever released since 5.6.0, and they all work as expected. Here is the shortened list of results (I skipped all development releases and older versions of stable branches, but included 5.8.8):

$ cat test.pl use strict; use warnings; sub timestamp { my @st = localtime (shift); return sprintf "%04d-%02d-%02dT%02d:%02d:%02d.000-0700", $st[5] + 1900, ++$st[4], @st[3,2,1,0]; } sub starttimestamp { return timestamp (time); } sub endtimestamp { return timestamp (time + (15 * 60)); } sub futuretimestamp { return timestamp (time + shift); } my $fts = futuretimestamp (162 * 60 * 60); # Stamp 162 hours ahead print $fts, "\n"; $ perl-all test.pl === base/perl5.6.2 5.006002 i686-linux-64int-perlio 2013-12-02T06:46:51.000-0700 === base/tperl5.6.2 5.006002 i686-linux-thread-multi-64int-ld-perli +o 2013-12-02T06:46:52.000-0700 === base/perl5.8.8 5.008008 i686-linux-64int 2013-12-02T06:46:56.000-0700 === base/tperl5.8.8 5.008008 i686-linux-thread-multi-64int-ld 2013-12-02T06:46:56.000-0700 === base/perl5.8.9 5.008009 i686-linux-64int 2013-12-02T06:46:56.000-0700 === base/tperl5.8.9 5.008009 i686-linux-thread-multi-64int-ld 2013-12-02T06:46:57.000-0700 === base/perl5.10.1 5.010001 i686-linux-64int 2013-12-02T06:46:58.000-0700 === base/tperl5.10.1 5.010001 i686-linux-thread-multi-64int-ld 2013-12-02T06:46:58.000-0700 === base/perl5.12.5 5.012005 i686-linux-64int 2013-12-02T06:47:05.000-0700 === base/tperl5.12.5 5.012005 i686-linux-thread-multi-64int-ld 2013-12-02T06:47:05.000-0700 === base/cperl5.14.4 5.014004 i686-linux-64int-ld 2013-12-02T06:47:15.000-0700 === base/perl5.14.4 5.014004 i686-linux-64int 2013-12-02T06:47:16.000-0700 === base/tperl5.14.4 5.014004 i686-linux-thread-multi-64int-ld 2013-12-02T06:47:16.000-0700 === base/cperl5.16.3 5.016003 i686-linux-64int-ld 2013-12-02T06:47:25.000-0700 === base/perl5.16.3 5.016003 i686-linux-64int 2013-12-02T06:47:25.000-0700 === base/tperl5.16.3 5.016003 i686-linux-thread-multi-64int-ld 2013-12-02T06:47:26.000-0700 === base/cperl5.18.2 5.018002 i686-linux-64int-ld 2013-12-02T06:47:36.000-0700 === base/perl5.18.2 5.018002 i686-linux-64int 2013-12-02T06:47:37.000-0700 === base/tperl5.18.2 5.018002 i686-linux-thread-multi-64int-ld 2013-12-02T06:47:37.000-0700

Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 03:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found