以毫秒为单位获取时间的命令 [英] Command to get time in milliseconds
本文介绍了以毫秒为单位获取时间的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Linux 中是否有 shell 命令以毫秒为单位获取时间?
Is there a shell command in Linux to get the time in milliseconds?
推荐答案
date +%s%N
返回秒数 + 当前纳秒.
date +%s%N
returns the number of seconds + current nanoseconds.
因此,echo $(($(date +%s%N)/1000000))
正是您所需要的.
Therefore, echo $(($(date +%s%N)/1000000))
is what you need.
示例:
$ echo $(($(date +%s%N)/1000000))
1535546718115
date +%s
返回自纪元以来的秒数(如果有用的话).
date +%s
returns the number of seconds since the epoch, if that's useful.
这篇关于以毫秒为单位获取时间的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文