I have this jQuery function that returns the current time as the number of milliseconds since the epoch (Jan 1, 1970):
jQuery
time = new Date().getTime
(Time.now.to_f * 1000).to_i should do the same thing.
(Time.now.to_f * 1000).to_i