mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
0019667ce6
closes #396
26 lines
561 B
Ruby
26 lines
561 B
Ruby
module Fog
|
|
class Time < ::Time
|
|
|
|
DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
|
|
def self.now
|
|
at((::Time.now - offset).to_i)
|
|
end
|
|
|
|
def self.now=(new_now)
|
|
old_now = ::Time.now
|
|
@offset = old_now - new_now
|
|
new_now
|
|
end
|
|
|
|
def self.offset
|
|
@offset ||= 0
|
|
end
|
|
|
|
def to_date_header
|
|
self.utc.strftime("#{DAYS[self.utc.wday]}, %d #{MONTHS[self.utc.month - 1]} %Y %H:%M:%S +0000")
|
|
end
|
|
|
|
end
|
|
end
|