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
The typecast Integer(1e6*Time.now.to_f) returns a Bignum that can hold the milliseconds