Sha256: 7b9162212448c481dceb7460ed8baf46b2ce31b5d3e097bdd14f43847e001cee

Contents?: true

Size: 637 Bytes

Versions: 4

Compression:

Stored size: 637 Bytes

Contents

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

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

  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/core/time.rb
fog-test-again-1.6.0 lib/fog/core/time.rb
fog-parser-fix-1.6.0 lib/fog/core/time.rb
fog-1.6.0 lib/fog/core/time.rb