Skip to content

Instantly share code, notes, and snippets.

@citrus
Created February 12, 2013 02:18
Show Gist options
  • Save citrus/4759619 to your computer and use it in GitHub Desktop.
Save citrus/4759619 to your computer and use it in GitHub Desktop.
Time Hacks
module TimeHacks
class << Time
def now
Time.new + offset
end
def offset
@offset ||= 0
end
def offset=(value)
@offset = value
end
end
end
Time.offset = 86400
Time.send(:extend, TimeHacks)
puts Time.now
@Streek
Copy link

Streek commented Feb 12, 2013

Hells yea, that's what I'm talking about.

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