#!/usr/bin/ruby
#
# Retrieve the difference from `pool.ntp.org` time, in seconds.
#

#
# Ensure that our load-path is sane.
#
$LOAD_PATH << '/usr/share/bytemark'
require 'healthcheck/ntp'

#
# Use the NTP-class to get the difference.
#
begin
  ntp = Bytemark::Healthcheck::Net::NTP.get.time
  now  = Time.now
  diff = (now - ntp)
  puts diff
rescue StandardError => ex
  STDERR.puts(ex.message)
  puts 0
end
