How to get the time at millisecond level on Linux with command line?

I know that gettimeofday() is a nice API. But how to get the number of seconds with milliseconds since the epoch time?

You can get the time at nano-seconds level (although it is not guaranteed that the last digits are accurate) by:

date +%s.%N

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *