Monday, August 23, 2010

Ruby get time in milliseconds


If you want to get the current time in milliseconds in Ruby, type this following Ruby code.

Thanks to Antoine that show me the mistake ;-)*1000

1 comment:

  1. This is false - to_f returns the time as the number of seconds since epoch. You need to multiply by 1000 to get the number of milliseconds.