Ruby - more accurate timestamp than Time.now.utc

ruby

Solution

From the Time docs:

The object created will be created using the resolution available on your system clock, and so may include fractional seconds.

Examples:

a = Time.new 
"%.6f" % a.to_f

=> "1334402161.334542"

Problem

Normally I use `Time.now.utc` for the timestamp in my project. But this time it looks it's not accurate enough to just use `Time.now.utc`. It looks that `Time.now.utc` is on second level(is it correct?), is not as accurate as I want. Is there ways to generate timestamp on milliseconds level?

Original source