Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created May 23, 2012 02:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wtnabe/2772855 to your computer and use it in GitHub Desktop.
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