Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Timer subtraction

by Discipulus (Monsignor)
on Oct 06, 2017 at 08:38 UTC ( #1200806=note: print w/replies, xml ) Need Help??


in reply to Timer subtraction

Hello, a fast search return Time::Piece to be agood candidate for such subtraction, but it seems does not handles milliseconds

# pay attention to MSwin32 doublequotes perl -MTime::Piece -E "$t1=Time::Piece->strptime('23:58:59','%H:%M:%S' +);$t2=Time::Piece->strptime('23:56:58','%H:%M:%S');say $diff=($t1-$t2 +)" 121 # or directly subtracting perl -MTime::Piece -E "say Time::Piece->strptime('23:58:59','%H:%M:%S' +) - Time::Piece->strptime('23:56:58', '%H:%M:%S' )" 121

L*

PS Time::Hires and it's tv_interval supports millisecnds operations: see Re: time difference in milliseconds

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1200806]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2017-12-17 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (466 votes). Check out past polls.

    Notices?