Skip to content

Instantly share code, notes, and snippets.

@jodell
Created April 20, 2014 19:15
Show Gist options
  • Save jodell/11122578 to your computer and use it in GitHub Desktop.
Save jodell/11122578 to your computer and use it in GitHub Desktop.
Ruby Time Parsing
ti = Time.now.to_i
t = Time.now.to_s
2.0.0-p451 :015 > puts Benchmark.measure { 100_000.times { Time.at(ti) } }
0.030000 0.000000 0.030000 ( 0.041530)
=> nil
2.0.0-p451 :016 > puts Benchmark.measure { 100_000.times { Time.parse(t) } }
2.680000 0.070000 2.750000 ( 2.755467)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment