How do I get elapsed time in milliseconds in Ruby?

前端 未结 10 2180
走了就别回头了
走了就别回头了 2020-12-13 05:27

If I have a Time object got from :

Time.now

and later I instantiate another object with that same line, how can I see how many

10条回答
  •  盖世英雄少女心
    2020-12-13 05:52

    DateTime.now.strftime("%Q")
    

    Example usage:

    >> DateTime.now.strftime("%Q")
    => "1541433332357"
    
    >> DateTime.now.strftime("%Q").to_i
    => 1541433332357
    

提交回复
热议问题