Set the timeout in milliseconds to auto cancel the promise

@param {int} milliseconds
@return this
764243
function (milliseconds) {
        if (milliseconds === undefined) {
            milliseconds = this._timeout;
        }

        var self = this;

        if (self._timeout !== milliseconds) {
            self._timeout = milliseconds;
            if (self._timer) {
                clearTimeout(this._timer);
                self._timer = null;
            }

            if (milliseconds) {
                this._timer = setTimeout(function () {
                    self._timer = null;
                    if (!self.finished) {
                        var error = new core.Error({
                            code: 'timeout',
                            message: 'Promise has timeout'
                        });

                        /*if (self.getPromise().cancel) {
                            self.getPromise().cancel(error);
                        } else {
                            self.emitError(error);
                        }*/

                        if (this._canceller) {
                            self.cancel(error);
                        } else {
                            self.emitError(error);
                        }
                    }
                }, milliseconds);
            }
        }
        return this;
    }
1150399
@Override
    public void stop(long millisec) throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Stop channel: " + this + " time=" + millisec);
        }
        if (0L < millisec) {
            this.quiescing = true;
            if (0 == this.activeConnections.get()) {
                // no current connections, notify the final stop can happen now
                signalNoConnections();
            }
        } else {
            this.quiescing = false;
            stop0Called = true;
        }
    }
625093
public CliCommandBuilder setTimeout(final int timeout) {
        if (timeout > 0) {
            addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
        } else {
            addCliArgument(CliArgument.TIMEOUT, null);
        }
        return this;
    }
1258431
@Override
	public Promise waitForServices(long timeoutMillis, Collection<String> services) {
		if (services == null || services.isEmpty() || isServicesOnline(services)) {
			return Promise.resolve();
		}
		Promise promise = new Promise();
		long timeoutAt;
		if (timeoutMillis > 0) {
			timeoutAt = System.currentTimeMillis() + timeoutMillis;
		} else {
			timeoutAt = 0;
		}
		ServiceListener listener = new ServiceListener(promise, timeoutAt, services);
		synchronized (serviceListeners) {
			serviceListeners.addLast(listener);
			if (servicesOnlineTimer == null) {
				servicesOnlineTimer = scheduler.scheduleWithFixedDelay(this::checkServicesOnline, 1, 1,
						TimeUnit.SECONDS);
			}
		}
		return promise;
	}
1288771
public static void setScreenOffTimeout(Context context, int millis) {
		Settings.System.putInt(context.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, millis);
	}
642074
public function addTimeout($millisecond, $callback, $args=null)
    {
        return $this->add($millisecond, static::EV_TIMEOUT, $callback, $args);
    }
214011
public void setNetworkTimeout(Executor executor, final int milliseconds) throws SQLException {
    if (this.isClosed()) {
      throw ExceptionMapper
          .getSqlException("Connection.setNetworkTimeout cannot be called on a closed connection");
    }
    if (milliseconds < 0) {
      throw ExceptionMapper
          .getSqlException("Connection.setNetworkTimeout cannot be called with a negative timeout");
    }
    SQLPermission sqlPermission = new SQLPermission("setNetworkTimeout");
    SecurityManager securityManager = System.getSecurityManager();
    if (securityManager != null) {
      securityManager.checkPermission(sqlPermission);
    }
    try {
      stateFlag |= ConnectionState.STATE_NETWORK_TIMEOUT;
      protocol.setTimeout(milliseconds);
    } catch (SocketException se) {
      throw ExceptionMapper.getSqlException("Cannot set the network timeout", se);
    }
  }
741193
function _execTimeout(timeout, callback) {
    // store the timeout in the queue with timeouts in progress
    // it can be cleared when a clearTimeout is executed inside the callback
    current[timeout.id] = timeout;

    function finish() {
      // in case of an interval we have to reschedule on next cycle
      // interval must not be cleared while executing the callback
      if (timeout.type === TYPE.INTERVAL && current[timeout.id]) {
        timeout.occurrence++;
        timeout.time = timeout.firstTime + timeout.occurrence * timeout.interval;
        _queueTimeout(timeout);
        //console.log('queue timeout', timer.getTime().toISOString(), new Date(timeout.time).toISOString(), timeout.occurrence) // TODO: cleanup
      }

      // remove the timeout from the queue with timeouts in progress
      delete current[timeout.id];

      callback && callback();
    }

    // execute the callback
    try {
      if (timeout.callback.length == 0) {
        // synchronous timeout,  like `timer.setTimeout(function () {...}, delay)`
        timeout.callback();
        finish();
      } else {
        // asynchronous timeout, like `timer.setTimeout(function (done) {...; done(); }, delay)`
        timeout.callback(finish);
      }
    } catch (err) {
      // emit or log the error
      if (hasListeners(timer, 'error')) {
        timer.emit('error', err);
      }
      else {
        console.log('Error', err);
      }

      finish();
    }
  }
378777
function (timeout) {
            if (!this.closed) {
                if (this.notification) {
                    this._closeTimeout = this._closeTimeout || setTimeout(_.bind(this.close, this), timeout);
                } else {
                    this.once('show', _.bind(this.closeAfter, this, timeout));
                }
            }
            return this;
        }
261161
public void setTimeout(long timeout, TimeUnit unit)
    {
        this.timeout = TimeUnit.MILLISECONDS.convert(timeout, unit);
    }
611826
public FluoConfiguration setConnectionRetryTimeout(int timeoutMS) {
    Preconditions.checkArgument(timeoutMS >= -1,
        CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1");
    setProperty(CONNECTION_RETRY_TIMEOUT_MS_PROP, timeoutMS);
    return this;
  }
305677
function later( delay ) {
    if ( typeof delay === 'undefined' ) delay = 1;
    return new Promise(
        function( resolve, reject ) {
            window.setTimeout( resolve, delay );
        }
    );
}
409782
function delay(timeout, value) {
        if (timeout < 0) {
            return value;
        }

        var future = new Future();
        setTimeout(function () {
            future.resolve(value);
        }, timeout);
        return future;
    }
437209
function(debug, milliseconds)
{

    if(debug == null)
    {
        this_debug = false;
    }
    else
    {
        this._debug = debug;
    }

    if(milliseconds == null)
    {
        this._milliseconds = false;
    }
    else
    {
        this._milliseconds = true;
    }


}
305594
public void setConnectTimeout(int millis) {
		ClientHttpRequestFactory f = getRequestFactory();
		if (f instanceof SimpleClientHttpRequestFactory) {
			((SimpleClientHttpRequestFactory) f).setConnectTimeout(millis);
		}
		else {
			((HttpComponentsClientHttpRequestFactory) f).setConnectTimeout(millis);
		}
	}
1236530
@Override
	public CompletableFuture<Acknowledge> cancel(Time timeout) {
		executionGraph.cancel();

		return CompletableFuture.completedFuture(Acknowledge.get());
	}
1367442
@Contract(pure = true)
	@NotNull
	public static <T> Promise<T> delay(@NotNull Promise<T> promise, long delayMillis) {
		if (delayMillis <= 0) return promise;
		MaterializedPromise<T> materializedPromise = promise.materialize();
		return Promise.ofCallback(cb ->
				getCurrentEventloop().delay(delayMillis, () -> materializedPromise.whenComplete(cb)));
	}