module Evesync::NTP

Public Class Methods

time() click to toggle source
# File lib/evesync/ntp.rb, line 8
def self.time
  begin
    Timeout.timeout(5) do
      Net::NTP.get(Config['ntp']).time
    end
  rescue Errno::ECONNREFUSED
    Log.warn('NTP not configured. Using local time for timestamps')
    Time.now
  rescue Timeout::Error
    Log.warn('NTP timeout. Using local time')
    Time.now
  end
end
timestamp() click to toggle source
# File lib/evesync/ntp.rb, line 22
def self.timestamp
  time.to_f.to_s
end