Class: Fog::Time

Inherits:
Time
  • Object
show all
Defined in:
lib/fog/core/time.rb

Constant Summary collapse

DAYS =
%w(Sun Mon Tue Wed Thu Fri Sat)
MONTHS =
%w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.nowObject



8
9
10
# File 'lib/fog/core/time.rb', line 8

def self.now
  at(::Time.now - offset)
end

.now=(new_now) ⇒ Object



12
13
14
15
16
# File 'lib/fog/core/time.rb', line 12

def self.now=(new_now)
  old_now = ::Time.now
  @offset = old_now - new_now
  new_now
end

.offsetObject



18
19
20
# File 'lib/fog/core/time.rb', line 18

def self.offset
  @offset ||= 0
end

Instance Method Details

#to_date_headerObject



22
23
24
# File 'lib/fog/core/time.rb', line 22

def to_date_header
  utc.strftime("#{DAYS[utc.wday]}, %d #{MONTHS[utc.month - 1]} %Y %H:%M:%S +0000")
end

#to_iso8601_basicObject



26
27
28
# File 'lib/fog/core/time.rb', line 26

def to_iso8601_basic
  utc.strftime("%Y%m%dT%H%M%SZ")
end