Class: Fog::Time

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

Constant Summary

DAYS =
['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
MONTHS =
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) now



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

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

+ (Object) now=(new_now)



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

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

+ (Object) offset



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

def self.offset
  @offset ||= 0
end

Instance Method Details

- (Object) to_date_header



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

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

- (Object) to_iso8601_basic



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

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