Compare times from now and 10 seconds in the future.
require 'date' before_time = Time.now before_datetime = DateTime.now sleep(10) Time.now - before_time DateTime.now - before_datetime