class Downtime::Timestamp

Attributes

datetime[RW]

Public Class Methods

from_s(string) click to toggle source

Will create CET times.

# File lib/downtime/timestamp.rb, line 22
def self.from_s string
  Timestamp.new(DateTime.strptime string + " CET", @@time_pattern_zone)
end
new(time=DateTime.now) click to toggle source
# File lib/downtime/timestamp.rb, line 13
def initialize time=DateTime.now
  @datetime = time
end
time_pattern() click to toggle source
# File lib/downtime/timestamp.rb, line 9
def self.time_pattern
  @@time_pattern
end

Public Instance Methods

-(other_timestamp) click to toggle source

Returns difference to other timestamp in minutes.

# File lib/downtime/timestamp.rb, line 27
def -(other_timestamp)
  ((@datetime.to_time - other_timestamp.datetime.to_time) / 60.0).to_i
end
to_s() click to toggle source
# File lib/downtime/timestamp.rb, line 17
def to_s
  @datetime.strftime @@time_pattern
end