/*
Sensor
param options {Object}
getTimeout: timeout in ms, default recommendedInterval*2
connTimeout: timeout in ms, driver specific default
433750
function Sensor(sensorInfo, options) {
  var props = this.properties = this.constructor.properties;
  var id = sensorInfo.id;

  if (id) {
    this.id = id;
  } else {
    if (props && props.id) {
      this.id = template(props.id, options);
    }
  }
  this.info = sensorInfo;
  this.options =  _.defaults(options || {}, sensorInfo.options);
  this.model = sensorInfo.model;
  this.device = sensorInfo.device;

  EventEmitter.call(this);
}
379020
function _stopTimer(timer, options) {
        if (timer) {
          options.timeLimit = _getTimeLeft(timer);
          clearTimeout(timer);
        }
      }
432745
function(timeout, fn, invokeAsap, ctx) {
				var timer;
				if (arguments.length === 3 && typeof invokeAsap !== "boolean") {
					ctx = invokeAsap;
					invokeAsap = false;
				}
				return function() {
					var args = arguments;
					ctx = ctx || this;
					invokeAsap && !timer && fn.apply(ctx, args);
					clearTimeout(timer);
					timer = setTimeout(function() {
						invokeAsap || fn.apply(ctx, args);
						timer = null;
					}, timeout);
				};
			}
137214
def poll(self, timeout=None):
        
        next_usb_timeout = self.__context.getNextTimeout()
        if timeout is None or timeout < 0:
            usb_timeout = next_usb_timeout
        elif next_usb_timeout:
            usb_timeout = min(next_usb_timeout, timeout)
        else:
            usb_timeout = timeout
        event_list = self.__poller.poll(usb_timeout)
        if event_list:
            fd_set = self.__fd_set
            result = [(x, y) for x, y in event_list if x not in fd_set]
            if len(result) != len(event_list):
                self.__context.handleEventsTimeout()
        else:
            result = event_list
            self.__context.handleEventsTimeout()
        return result
650002
function _startTimeout(o, t) {
        _timeout[o.id] = w.setTimeout(function() { _ioCancel(o, 'timeout'); }, t);
    }
861314
public void setDefaultTimeout(long timeout, TimeUnit unit) {
        this.timeout = timeout;
        this.unit    = unit;
        bootstrap.setOption("connectTimeoutMillis", unit.toMillis(timeout));
    }
1092417
static String getStrDefaultTimeout()
	{
		//	Check if already done
		if (default_timeout==null)
			if ((default_timeout=System.getProperty("TANGO_TIMEOUT"))==null)	//	From JVM property
				if ((default_timeout=System.getenv("TANGO_TIMEOUT"))==null)		//	From Environment property
					default_timeout = getFromEnvFile("TANGO_TIMEOUT");		//	From Environment file
		//	else
		return default_timeout;
	}
1362585
function(callback, timeInMs) {
    var timeout = makeTimeout(function() {
      setTriggerTime(timeout, timeout.timeInMs);
      s_timeoutsToInsert.push(timeout);
      callback();
    });
    timeout.timeInMs = timeInMs;
    s_timeoutsToInsert.push(timeout);
    return timeout.id;
  }
1355993
function(handler) {
      var t = this;
      if (t.monitor && t.monitor.isConnected()) {
        setTimeout(function(){handler(t.monitor);},0);
      }
      else {
        t.connectHandlers.push(handler);
      }
    }
270552
protected int getTimeout(Dsn dsn) {
        return Util.parseInteger(Lookup.lookup(TIMEOUT_OPTION, dsn), TIMEOUT_DEFAULT);
    }
636601
function withTimeout_p(timeoutMs, promise, label) {
  label = label || 'Operation';
  var defer = Q.defer();
  promise.then(
    function(value) {
      defer.resolve(value);
    },
    function(err) {
      defer.reject(err);
    }
  );
  setTimeout(function() {
    var err = new Error(label + ' timed out');
    err.code = 'ETIMEOUT';
    defer.reject(err);
  }, timeoutMs);
  return defer.promise;
}
140682
def _get_timeout(self, timeout):
        '''
        
        '''
        if timeout is None:
            return self.opts['timeout']
        if isinstance(timeout, int):
            return timeout
        if isinstance(timeout, six.string_types):
            try:
                return int(timeout)
            except ValueError:
                return self.opts['timeout']
        # Looks like the timeout is invalid, use config
        return self.opts['timeout']
659343
public AndroidRemoveApplicationOptions withTimeout(Duration timeout) {
        checkArgument(!checkNotNull(timeout).isNegative(),
                "The timeout value cannot be negative");
        this.timeout = timeout;
        return this;
    }
144701
private long determineTimeout() {

        long timeout = getReceiveTimeout();

        JmsResourceHolder resourceHolder = (JmsResourceHolder) TransactionSynchronizationManager
                .getResource(getConnectionFactory());
        if (resourceHolder != null && resourceHolder.hasTimeout()) {
            timeout = Math.min(timeout, resourceHolder.getTimeToLiveInMillis());
        }
        return timeout;
    }
1344632
private static int resolveDomainTimeoutAdder() {
        String propValue = WildFlySecurityManager.getPropertyPrivileged(DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_STRING);
        if (sysPropDomainValue == null || !sysPropDomainValue.equals(propValue)) {
            // First call or the system property changed
            sysPropDomainValue = propValue;
            int number = -1;
            try {
                number = Integer.valueOf(sysPropDomainValue);
            } catch (NumberFormatException nfe) {
                // ignored
            }

            if (number > 0) {
                defaultDomainValue = number; // this one is in ms
            } else {
                ControllerLogger.MGMT_OP_LOGGER.invalidDefaultBlockingTimeout(sysPropDomainValue, DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_ADDER);
                defaultDomainValue = DEFAULT_DOMAIN_TIMEOUT_ADDER;
            }
        }
        return defaultDomainValue;
    }
18000
function stopTimeout(ctx) {
  assert(ctx);
  if (ctx.timer != null) {
    clearTimeout(ctx.timer);
    ctx.timer = null;
  }
  ctx.stopped = true;
}
1152830
function getIntentHandler(method, options) {
  var lastEvent = null;
  var timeout = null;

  var opts = extend({
    intentDelay: 200
  }, options);

  var triggerIntent = function() {
    method(lastEvent);
  };

  var startIntent = function(evt) {
    lastEvent = evt;
    clearTimeout(timeout);
    timeout = setTimeout(triggerIntent, opts.intentDelay);
  };

  var stopIntent = function() {
    lastEvent = null;
    clearTimeout(timeout);
  };

  return {
    startIntent: startIntent,
    stopIntent: stopIntent
  };
}