Sha256: acf6d87071c3a20efd7f4c81fd58a6ea999405cb4aa2d7e55d409d3e4fab2faa

Contents?: true

Size: 653 Bytes

Versions: 81

Compression:

Stored size: 653 Bytes

Contents

require 'time'

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

81 entries across 81 versions & 11 rubygems

Version Path
fog-maestrodev-1.18.0.20131219032002 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/core/time.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/core/time.rb
gapinc-fog-1.12.1.2.1 lib/fog/core/time.rb