Class: Time

Inherits:
Object show all
Defined in:
lib/webget_ruby_ramp/time.rb

Overview

Time extensions

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.packObject

Shorthand for Time.now.pack

Example

Time.pack => "20101231125959"


49
50
51
# File 'lib/webget_ruby_ramp/time.rb', line 49

def self.pack
  now.pack
end

.stampObject

Shorthand for Time.now.stamp

Example

Time.stamp => "2010-12-31 12:59:59Z"


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

def self.stamp
  now.stamp
end

Instance Method Details

#packObject

Return time packed into a short string: “YYYYMMDDHHMMSS”

The time is converted to UTC.

Example

Time.now.pack => "20101231125959"


39
40
41
# File 'lib/webget_ruby_ramp/time.rb', line 39

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

#stampObject

Return 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 www.ietf.org/rfc/rfc3339.txt

Example

Time.now.stamp => "2010-12-31 12:59:59Z"


17
18
19
# File 'lib/webget_ruby_ramp/time.rb', line 17

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