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
require 'date' p DateTime.now.strftime('%s') # "1384526946" (seconds) p DateTime.now.strftime('%Q') # "1384526946523" (milliseconds)