def NewEventId():
 global EVENT_COUNTER
 with EVENT_COUNTER_LOCK:
  EVENT_COUNTER = (EVENT_COUNTER + 1)
  EVENT_COUNTER %= 1048576
  return ('%8.8x-%5.5x-%x' % (time.time(), EVENT_COUNTER, os.getpid()))

def NewEventId ( ) : global EVENT_COUNTER with EVENT_COUNTER_LOCK : EVENT_COUNTER = ( EVENT_COUNTER + 1 ) EVENT_COUNTER %= 1048576 return ( '%8.8x-%5.5x-%x' % ( time . time ( ) , EVENT_COUNTER , os . getpid ( ) ) )
this is guaranteed to generate unique event ids for up to 1 million events per second .