2010-12-21 15:12:30 -05:00
|
|
|
module Fog
|
|
|
|
class Time < ::Time
|
|
|
|
|
2011-01-28 18:33:35 -05:00
|
|
|
DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|
|
|
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
2010-12-21 15:12:30 -05:00
|
|
|
|
2011-01-28 18:33:35 -05:00
|
|
|
def self.now
|
|
|
|
at((::Time.now - offset).to_i)
|
|
|
|
end
|
2010-12-21 15:12:30 -05:00
|
|
|
|
2011-01-28 18:33:35 -05:00
|
|
|
def self.now=(new_now)
|
|
|
|
old_now = ::Time.now
|
|
|
|
@offset = old_now - new_now
|
|
|
|
new_now
|
|
|
|
end
|
2010-12-21 15:12:30 -05:00
|
|
|
|
2011-01-28 18:33:35 -05:00
|
|
|
def self.offset
|
|
|
|
@offset ||= 0
|
2010-12-21 15:12:30 -05:00
|
|
|
end
|
2011-01-28 18:33:35 -05:00
|
|
|
|
|
|
|
def to_date_header
|
2011-07-06 13:44:01 -04:00
|
|
|
self.utc.strftime("#{DAYS[self.utc.wday]}, %d #{MONTHS[self.utc.month - 1]} %Y %H:%M:%S +0000")
|
2011-01-28 18:33:35 -05:00
|
|
|
end
|
|
|
|
|
2010-12-21 15:12:30 -05:00
|
|
|
end
|
2011-01-28 18:33:35 -05:00
|
|
|
end
|