Helper function to setup a single timer.
434273
function setupTimer(opts) {
                var name, timer;
                name = opts.name || node.game.timer.name;
                timer = node.timer.getTimer(name);

                if (!timer) {
                    node.warn('setup("timer"): timer not found: ' + name);
                    return false;
                }

                if (opts.options) timer.init(opts.options);

                switch (opts.action) {
                case 'start':
                    timer.start();
                    break;
                case 'stop':
                    timer.stop();
                    break;
                case 'restart':
                    timer.restart();
                    break;
                case 'pause':
                    timer.pause();
                    break;
                case 'resume':
                    timer.resume();
                }

                return true;
            }
583961
def init_timer(self, max_value):
    
    self.__max_value = max_value
    self.__prev_tick = time.time()
    self.__unit_per_sec = 0
    self.__unit_per_sec_prev = 0
617917
function Timer (callback, start) {
  this.callback = callback;
  this.startDate = null;
  if (!exists(start) || start !== false) {
    this.start();
  }
}
1047050
def set_timeout(self, timeout, callback):
        """"""
        if not self._ready_sem.acquire(False):
            raise Scapy_Exception("Timer was already started")

        self._callback = callback
        self._timeout = timeout
        self._cancelled.clear()
        self._busy_sem.release()
284743
def set_timer(self, num_secs):
        
        # FIXME / TODO support schemas? Accept timer id number as parameter?

        # Dumb heuristic; Query status, pick last device id as that is probably the timer
        status = self.status()
        devices = status['dps']
        devices_numbers = list(devices.keys())
        devices_numbers.sort()
        dps_id = devices_numbers[-1]

        payload = self.generate_payload(SET, {dps_id:num_secs})

        data = self._send_receive(payload)
        log.debug('set_timer received data=%r', data)
        return data
937435
def timerEvent( self, event ):
        
        self.killTimer(event.timerId())
        
        self.setMaximumWidth(10000)
        self.setMaximumHeight(10000)
51404
function createTimeout(timer, i, callback) {
    return setTimeout(function() {
        callback(timer, i);
    }, timer.seconds * 1000);
}
9882
def setTimeout(self, time):
        """"""
        self.conversation.SetDDETimeout(round(time))
        return self.conversation.GetDDETimeout()
1233101
def run_after_async(seconds, func, *args, **kwargs):
    """"""
    t = Timer(seconds, func, args, kwargs)
    t.daemon = True
    t.start()
    return t
1264166
private function createTimerCallback()
    {
        $that = $this;
        $timers = $this->timerEvents;
        $this->timerCallback = function ($_, $__, $timer) use ($timers, $that) {
            \call_user_func($timer->getCallback(), $timer);

            // Timer already cancelled ...
            if (!$timers->contains($timer)) {
                return;
            }

            // Reschedule periodic timers ...
            if ($timer->isPeriodic()) {
                \event_add(
                    $timers[$timer],
                    $timer->getInterval() * ExtLibeventLoop::MICROSECONDS_PER_SECOND
                );

            // Clean-up one shot timers ...
            } else {
                $that->cancelTimer($timer);
            }
        };
    }
75188
def settimeout(self, timeout):
        '''
        
        '''
        if timeout is None:
            self._block = True
        elif float(timeout) == 0.0:
            self._block = False
        else:
            self._timeout = float(timeout)
            self._block = True
1076379
def _timer(self, state_transition_event=None):
        """"""
        while not self._teardown.value:
            state = self.get_roaster_state()
            if(state == 'roasting' or state == 'cooling'):
                time.sleep(1)
                self.total_time += 1
                if(self.time_remaining > 0):
                    self.time_remaining -= 1
                else:
                    if(state_transition_event is not None):
                        state_transition_event.set()
                    else:
                        self.idle()
            else:
                time.sleep(0.01)
677940
function(factory, options) {
			factory.timer.interval = 0;
			factory.autoStart 	   = false;
			factory.running  	   = true;

			factory.increment = function() {
				factory.countdown = false;
				factory.setTime(factory.getTime().time + 1);
			};

			factory.decrement = function() {
				factory.countdown = true;
				factory.setTime(factory.getTime().time - 1);
			};

			factory.setValue = function(digits) {
				factory.setTime(digits);
			};

			factory.setCounter = function(digits) {
				factory.setTime(digits);
			};

			this.base(factory, options);
		}
1305871
def _timer_update(self):
        """"""
        self._timer_counter += 1
        dot = self._timer_dots.pop(0)
        self._timer_dots = self._timer_dots + [dot]
        self._rows = [[_(u'Resolving dependencies') + dot, u'', u'', u'']]
        index = self.createIndex(0, 0)
        self.dataChanged.emit(index, index)

        if self._timer_counter > 150:
            self._timer.stop()
            self._timer_counter = 0
824333
function setTimer(job){
  clearTimeout(timer);

  timer = setTimeout(excuteJob, job.excuteTime()-Date.now());
}
622743
function(count, opts, cb) {
  this.count = count;
  this.cb = cb;
  var self = this;
  if (opts.timeout) {
    this.timerId = setTimeout(function() {
      self.cb(true);
    }, opts.timeout);
  }
}
55755
function (fn, delay) {
    var timer = null;
    if (!delay || delay < 16) {
      delay = 16;
    }

    return function () {
      var _this = this;
      var args = arguments;

      if (timer === null) {
        timer = setTimeout(function () {
          fn.apply(_this, args);
          timer = null;
        }, delay);
      }
    };
  }