Sha256: 10699070a69274425fd71919c0ccd6e717d5f72d17dbb4ba5e02c507a6db6f6c

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

# -*- coding: utf-8 -*-

# Time extensions

class Time


  # @return [String] a time stamp string in standard format: "YYYY-MM-DD HH:MM:SSZ"
  #
  # This standard format is specified in IETF RFC 3339 and ISO 8601.
  #
  # @see http://www.ietf.org/rfc/rfc3339.txt
  #
  # @example
  #   Time.now.stamp 
  #   => "2010-12-31 12:59:59Z" 

  def stamp
    getutc.strftime('%Y-%m-%d %H:%M:%SZ')
  end


  # Shorthand for Time.now.stamp
  #
  # @example
  #   Time.stamp
  #    => "2010-12-31 12:59:59Z" 
  #
  # @return [String] Time.now.stamp

  def self.stamp
    now.stamp
  end


  # @return [String] time packed into a short string: "YYYYMMDDHHMMSS"
  #
  # The time is converted to UTC.
  #
  # @example
  #   Time.now.pack
  #   => "20101231125959" 

  def pack
    getutc.strftime('%Y%m%d%H%M%S')
  end


  # Shorthand for Time.now.pack
  #
  # @example
  #   Time.pack
  #   => "20101231125959" 
  # 
  # @return [String] Time.now.pack                                                                                 

  def self.pack
    now.pack
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sixarm_ruby_ramp-5.0.1 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-5.0.0 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.2.7 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.2.5 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.2.4 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.2.3 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.2.2 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.1.0 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-4.0.0 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-3.0.0 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-2.1.3 lib/sixarm_ruby_ramp/time.rb
sixarm_ruby_ramp-2.1.0 lib/sixarm_ruby_ramp/time.rb