Check out example codes for "ruby measure time". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com