Linux的命令可以获得以毫秒为单位的时间 [英] Linux command to get time in milliseconds

查看:1488
本文介绍了Linux的命令可以获得以毫秒为单位的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在Linux的shell命令来获取毫秒时间?

Is there shell command in Linux to get the time in milliseconds?

推荐答案

日期+%S 返回自新纪元的秒数​​。

date +%s returns the number of seconds since the epoch.

日期+%S%N 返回秒+当前纳秒数。

date +%s%N returns the number of seconds + current nanoseconds.

因此​​,回声$(($(日期+%S%N)/ 1000000))是你所需要的。

Therefore, echo $(($(date +%s%N)/1000000)) is what you need

这篇关于Linux的命令可以获得以毫秒为单位的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆