Answers for "ruby get current time"

0

ruby get current datetime

require 'date'

current_datetime = DateTime.now
Posted by: Guest on April-29-2020
1

ruby measure time

starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)

# time consuming operation(s)

ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
elapsed = ending - starting
elapsed # => 9.424242424242424 seconds
Posted by: Guest on June-17-2020

Browse Popular Code Answers by Language