code: func (kcp *KCP) Check() uint32 {
  	current := currentMs()
  	ts_flush := kcp.ts_flush
  	tm_flush := int32(0x7fffffff)
  	tm_packet := int32(0x7fffffff)
  	minimal := uint32(0)
  	if kcp.updated == 0 {
  		return current
  	}
  
  	if _itimediff(current, ts_flush) >= 10000 ||
  		_itimediff(current, ts_flush) < -10000 {
  		ts_flush = current
  	}
  
  	if _itimediff(current, ts_flush) >= 0 {
  		return current
  	}
  
  	tm_flush = _itimediff(ts_flush, current)
  
  	for k := range kcp.snd_buf {
  		seg := &kcp.snd_buf[k]
  		diff := _itimediff(seg.resendts, current)
  		if diff <= 0 {
  			return current
  		}
  		if diff < tm_packet {
  			tm_packet = diff
  		}
  	}
  
  	minimal = uint32(tm_packet)
  	if tm_packet >= tm_flush {
  		minimal = uint32(tm_flush)
  	}
  	if minimal >= kcp.interval {
  		minimal = kcp.interval
  	}
  
  	return current + minimal
  }
docs: // Check determines when should you invoke ikcp_update:
  // returns when you should invoke ikcp_update in millisec, if there
  // is no ikcp_input/_send calling. you can call ikcp_update in that
  // time, instead of call update repeatly.
  // Important to reduce unnacessary ikcp_update invoking. use it to
  // schedule ikcp_update (eg. implementing an epoll-like mechanism,
  // or optimize ikcp_update when handling massive kcp connections)