module Nem::Util

Constants

MAINNET
MIJIN
NEM_EPOCH
TESTNET

Public Class Methods

deadline(seconds = 3600) click to toggle source
# File lib/nem/util.rb, line 26
def self.deadline(seconds = 3600)
  timestamp + seconds
end
parse_nemtime(nemtime) click to toggle source
# File lib/nem/util.rb, line 22
def self.parse_nemtime(nemtime)
  NEM_EPOCH + nemtime
end
parse_network(network) click to toggle source
# File lib/nem/util.rb, line 13
def self.parse_network(network)
  case network
  when :testnet then TESTNET
  when :mainnet then MAINNET
  when :mijin then MIJIN
    else TESTNET
  end
end
parse_version(network, version) click to toggle source
# File lib/nem/util.rb, line 9
def self.parse_version(network, version)
  parse_network(network) | version
end
timestamp() click to toggle source
# File lib/nem/util.rb, line 30
def self.timestamp
  # escape FAILURE_TIMESTAMP_TOO_FAR_IN_FUTURE
  (Time.now.utc - NEM_EPOCH).to_i - 30
end