Create a gist now

Instantly share code, notes, and snippets.

guard of wrong time deployment
require "open-uri"
NTP_SERVER = xxxx
ntp_time = Time.parse(URI("http://#{NTP_SERVER}").read.meta['date'])
local_time = Time.now
if ( (local_time.to_i - ntp_time.to_i).abs > 5 )
abort "Your machine is wrong !\nIs it #{local_time} now ?\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment