Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: displaying microseconds from epoch like format

by GrandFather (Saint)
on Oct 09, 2012 at 00:17 UTC ( [id://997901]=note: print w/replies, xml ) Need Help??


in reply to displaying microseconds from epoch like format

my $epTime = 1276218934.155029; my ($epoch, $frac) = $epTime =~ /(\d+)\.(\d+)/; (my $str = localtime $epoch) =~ s/(.*:\d+)/$1.$frac/; printf $str;

Prints:

Fri Jun 11 13:15:34.15503 2010
True laziness is hard work

Replies are listed 'Best First'.
Re^2: displaying microseconds from epoch like format
by r0adawg (Beadle) on Oct 09, 2012 at 18:01 UTC
    awesome,
    changed and tweaked to work with my code:
    ($c_epoch, $frac) = $ep_time =~ /(\d+)\.(\d+)/; #courtesy of perlmonks $c_epoch += $time; # converts to local time from internal date -> $FD $str = localtime $c_epoch) =~ s/(.*:\d+)/$1.$frac/; #courtesy of perlm +onks

    produces : Thu Jun 10 07:12:02.729004 2010

    I needed the finer resolution for processing.

    again thank you!

Log In?
Username:
Password:

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

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

    No recent polls found