class Nem::Unit::Time

Constants

NEM_EPOCH

Public Class Methods

new(value) click to toggle source
# File lib/nem/unit/time.rb, line 6
def initialize(value)
  @value = value
end
new_from_nemtime(nemtime) click to toggle source
# File lib/nem/unit/time.rb, line 34
def self.new_from_nemtime(nemtime)
  new(NEM_EPOCH + nemtime)
end
now() click to toggle source
# File lib/nem/unit/time.rb, line 30
def self.now
  new(::Time.now.utc)
end
parse(datetime) click to toggle source
# File lib/nem/unit/time.rb, line 26
def self.parse(datetime)
  new(::Time.parse(datetime))
end

Public Instance Methods

+(other) click to toggle source
# File lib/nem/unit/time.rb, line 10
def +(other)
  self.class.new(@value + other)
end
-(other) click to toggle source
# File lib/nem/unit/time.rb, line 14
def -(other)
  self.class.new(@value - other)
end
to_i() click to toggle source
# File lib/nem/unit/time.rb, line 18
def to_i
  (@value - NEM_EPOCH).to_i
end
to_time() click to toggle source
# File lib/nem/unit/time.rb, line 22
def to_time
  @value.to_time
end