Class: DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/stalkr.rb

Overview

monkey patch DateTime to add to_time (exists in Ruby 1.9.2 and above)

Instance Method Summary collapse

Instance Method Details

#to_timeObject



26
27
28
29
30
31
32
33
# File 'lib/stalkr.rb', line 26

def to_time
  d = new_offset(0)
  t = d.instance_eval do
    Time.utc(year, mon, mday, hour, min, sec +
             sec_fraction)
  end
  t.getlocal
end