Command to get time in milliseconds

后端 未结 12 939
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 04:01

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

12条回答
  •  旧巷少年郎
    2020-12-02 04:14

    Nano is 10−9 and milli 10−3. Hence, we can use the three first characters of nanoseconds to get the milliseconds:

    date +%s%3N
    

    From man date:

    %N nanoseconds (000000000..999999999)

    %s seconds since 1970-01-01 00:00:00 UTC

    Source: Server Fault's How do I get the current Unix time in milliseconds in Bash?.

提交回复
热议问题