Skip to content

Instantly share code, notes, and snippets.

@kotp
Last active August 29, 2015 14:17
Show Gist options
  • Save kotp/210e00496fbb6efe4e93 to your computer and use it in GitHub Desktop.
Save kotp/210e00496fbb6efe4e93 to your computer and use it in GitHub Desktop.
Result of refactoring other code, uses time library and features a proc.
require 'time'
get_time = ->(t) { [t.iso8601, t.usec] }
report = 'something to report with a detailed time: %s'
puts report % get_time[Time.now]
@DouglasAllen
Copy link

#test.rb

require_relative 'ctime'

puts "Time now is #{get_time}"
puts "#{e_sec} seconds since January 1, 1970"
t1 = Time.new(1970,01,01,0,0,0, "+00:00")# is there something else in Ruby Time to get this?
puts "Time now is #{t1 + e_sec}"
puts "#{system 'date'}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment