Пример #1
0
 def ntp_setup(self):
     try:
         self.time_manager = TimeManager()
         self.root_dispersion = self.time_manager.get_time_error()
         log.info(
             "We believe this system's clock is accurate to within %f seconds"
             % self.root_dispersion)
         if self.root_dispersion > 5.0:
             log.error(
                 "Sorry, your clock is out by more than 5 secs. Switzerland isn't going to work!"
             )
             sys.exit(1)
     except UncertainTimeError:
         if not self.config.allow_uncertain_time:
             print "  Please fix NTP!!\n"
             print "  (If that is not possible, you can specify an error bound on your system clock"
             print "  using the -u flag, but you must ensure that it is correct. Failure to do so"
             print "  may result in false reports of packet modification.)"
             print "  see http://switzerland.wiki.sourceforge.net/NTP for further details."
             sys.exit(1)
         else:
             #log.warn("NTP is not working:\n"+traceback.format_exc())
             log.warn(
                 "but allow_uncertain_time is set so we're defaulting the clock error to %f"
                 % self.config.manual_clock_error)
             self.root_dispersion = self.config.manual_clock_error
             self.time_manager.method = "blind faith"
     self.params["clock dispersion"] = self.root_dispersion