命令获取时间(以毫秒为单位) [英] Command to get time in milliseconds

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

问题描述

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))是您所需要的.

示例:

$ echo $(($(date +%s%N)/1000000))
1535546718115

date +%s返回自纪元以来的秒数,如果有用的话.

date +%s returns the number of seconds since the epoch, if that's useful.

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

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