Пример #1
0
void ConfigFile::setRemotePollInterval(chrono::milliseconds interval, const QString &connection)
{
    QString con(connection);
    if (connection.isEmpty())
        con = defaultConnection();

    if (interval < chrono::seconds(5)) {
        qCWarning(lcConfigFile) << "Remote Poll interval of " << interval.count() << " is below five seconds.";
        return;
    }
    QSettings settings(configFile(), QSettings::IniFormat);
    settings.beginGroup(con);
    settings.setValue(QLatin1String(remotePollIntervalC), qlonglong(interval.count()));
    settings.sync();
}
Пример #2
0
std::string Game::status(CHRONO::system_clock::time_point now, int score) {
    unsigned d = depth - eval.dMaxExt;
    std::stringstream g;
    if (Options::humanreadable) {
        g << Score<White>::str(score) << " " << tt->bestLine(*this); }
    else {
    	CHRONO::milliseconds t = CHRONO::duration_cast<CHRONO::milliseconds>(now-start);
        g   << "info depth " << d << " time " << t.count()
            << " nodes " << getStats().node
            << " pv " << tt->bestLine(*this)
            << " score cp " << score* color

            ; }
#ifdef QT_GUI_LIB
    emit(signalInfo(d, (uint64_t)(now-start).count(), getStats().node, QString::fromUtf8(Score<White>::str(score).c_str()), QString::fromStdString(tt->bestLine(*this))));
#endif
    return g.str(); }
    void _event_dispatcher_timer_impl::repeat_set(chrono::milliseconds timeout)
    {
         verify_access();

        _timer_repeat = timeout.count();

        if (_isEnabled)
        {
            start();
        }
    }
Пример #4
0
void HTTPConnector::connect(
  EventBase* eventBase,
  const folly::SocketAddress& connectAddr,
  chrono::milliseconds timeoutMs,
  const AsyncSocket::OptionMap& socketOptions,
  const folly::SocketAddress& bindAddr) {

  DCHECK(!isBusy());
  transportInfo_ = wangle::TransportInfo();
  transportInfo_.ssl = false;
  socket_.reset(new AsyncSocket(eventBase));
  connectStart_ = getCurrentTime();
  socket_->connect(this, connectAddr, timeoutMs.count(),
                   socketOptions, bindAddr);
}
Пример #5
0
void HTTPConnector::connectSSL(
  EventBase* eventBase,
  const folly::SocketAddress& connectAddr,
  const shared_ptr<SSLContext>& context,
  SSL_SESSION* session,
  chrono::milliseconds timeoutMs,
  const AsyncSocket::OptionMap& socketOptions,
  const folly::SocketAddress& bindAddr) {

  DCHECK(!isBusy());
  transportInfo_ = wangle::TransportInfo();
  transportInfo_.ssl = true;
  auto sslSock = new AsyncSSLSocket(context, eventBase);
  if (session) {
    sslSock->setSSLSession(session, true /* take ownership */);
  }
  socket_.reset(sslSock);
  connectStart_ = getCurrentTime();
  socket_->connect(this, connectAddr, timeoutMs.count(),
                   socketOptions, bindAddr);
}
Пример #6
0
void Defense::managePauseStart(chrono::milliseconds pauseStartTime)
{
    toNextAttackTime -= pauseStartTime.count() - lastAttackTime.count();
}