Created
February 12, 2013 02:18
-
-
Save citrus/4759619 to your computer and use it in GitHub Desktop.
Time Hacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hells yea, that's what I'm talking about.