<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def process(self):
        '''handle events and trigger time-related events'''
        timediff = 0
        while True:
            try:
                time.sleep(0.001)
                event = self.queue.get_nowait()
                self.handle_event(event)
                if event.msg & HC.KEY_ANY:
                    continue
                if timediff == 0:
                    timediff = time.time() - event.time
                self.touches[event.slotid] = event
            except Queue.Empty:
                if not self.running:
                    break
                now = time.time() - timediff
                for i in range(SLOT_NUM):
                    e = self.touches[i]
                    if e is None:
                        continue
                    if e.msg == HC.TOUCH_DOWN and now - e.time > self.long_press_delay:
                        self.analyze_tracks(TouchTimeoutEvent(now, HC.TOUCH_PRESS_TIMEOUT, i))
                        self.touches[i] = None
                    elif e.msg == HC.TOUCH_UP and now - e.time > self.double_tap_delay:
                        self.analyze_tracks(TouchTimeoutEvent(now, HC.TOUCH_FOLLOW_TIMEOUT, i))
                        self.touches[i] = None
                    elif e.msg == HC.TOUCH_MOVE and now - e.time > self.move_stop_delay:
                        self.analyze_tracks(TouchTimeoutEvent(now, HC.TOUCH_MOVESTOP_TIMEOUT, i))
                        self.touches[i] = None
            except:
                traceback.print_exc()

        print 'process done.'