Command to get time in milliseconds

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

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

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 04:31

    On OS X, where date does not support the %N flag, I recommend installing coreutils using Homebrew. This will give you access to a command called gdate that will behave as date does on Linux systems.

    brew install coreutils
    

    For a more "native" experience, you can always add this to your .bash_aliases:

    alias date='gdate'
    

    Then execute

    $ date +%s%N
    

提交回复
热议问题