// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
//
// Use -1 for infinite
//
// Returns ErrorNotImplemented in 0MQ version 2.1
//
// See: http://api.zeromq.org/2-2:zmq-setsockopt#toc9
490228
func (soc *Socket) SetRcvtimeo(value time.Duration) error {
	major, minor, _ := Version()
	if major == 2 && minor < 2 {
		return ErrorNotImplemented
	}
	val := int(value / time.Millisecond)
	if value == -1 {
		val = -1
	}
	return soc.setInt(C.ZMQ_RCVTIMEO, val)
}
751998
func (p *Peer) LastRecv() time.Time {
	return time.Unix(atomic.LoadInt64(&p.lastRecv), 0)
}
1197489
func (mr *MockQueryMockRecorder) SetMaxTime(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMaxTime", reflect.TypeOf((*MockQuery)(nil).SetMaxTime), arg0)
}
958302
func resyncPeriod(c *cloudcontrollerconfig.Config) func() time.Duration {
	return func() time.Duration {
		factor := rand.Float64() + 1
		return time.Duration(float64(c.ComponentConfig.Generic.MinResyncPeriod.Nanoseconds()) * factor)
	}
}
717775
func (m *Manager) refreshServerRebalanceTimer() time.Duration {
	l := m.getServerList()
	numServers := len(l.servers)
	// Limit this connection's life based on the size (and health) of the
	// cluster.  Never rebalance a connection more frequently than
	// connReuseLowWatermarkDuration, and make sure we never exceed
	// clusterWideRebalanceConnsPerSec operations/s across numLANMembers.
	clusterWideRebalanceConnsPerSec := float64(numServers * newRebalanceConnsPerSecPerServer)
	connReuseLowWatermarkDuration := clientRPCMinReuseDuration + lib.RandomStagger(clientRPCMinReuseDuration/clientRPCJitterFraction)
	numLANMembers := m.clusterInfo.NumNodes()
	connRebalanceTimeout := lib.RateScaledInterval(clusterWideRebalanceConnsPerSec, connReuseLowWatermarkDuration, numLANMembers)

	m.rebalanceTimer.Reset(connRebalanceTimeout)
	return connRebalanceTimeout
}
989799
func GetMaxEmitAtTimeSinceGPSEpochForMulticastGroup(db sqlx.Queryer, multicastGroupID uuid.UUID) (time.Duration, error) {
	var timeSinceGPSEpoch time.Duration
	err := sqlx.Get(db, &timeSinceGPSEpoch, `
		select
			coalesce(max(emit_at_time_since_gps_epoch), 0)
		from
			multicast_queue
		where
			multicast_group_id = $1
	`, multicastGroupID)
	if err != nil {
		return 0, handlePSQLError(err, "select error")
	}

	return timeSinceGPSEpoch, nil
}
1311107
func MaxTime(t1, t2 time.Time) time.Time {
	if t1.After(t2) {
		return t1
	}
	return t2
}
1134881
func (soc *Socket) GetRcvtimeo() (time.Duration, error) {
	major, minor, _ := Version()
	if major == 2 && minor < 2 {
		return 0, ErrorNotImplemented
	}
	v, err := soc.getInt(C.ZMQ_RCVTIMEO)
	if v < 0 {
		return time.Duration(-1), err
	}
	return time.Duration(v) * time.Millisecond, err
}
676888
func (fs *TermvectorsFilterSettings) MaxTermFreq(value int64) *TermvectorsFilterSettings {
	fs.maxTermFreq = &value
	return fs
}
560607
func (soc *Socket) GetReconnectIvl() (time.Duration, error) {
	v, err := soc.getInt(C.ZMQ_RECONNECT_IVL)
	return time.Duration(v) * time.Millisecond, err
}
1041698
func (soc *Socket) SetReconnectIvlMax(value time.Duration) error {
	val := int(value / time.Millisecond)
	return soc.setInt(C.ZMQ_RECONNECT_IVL_MAX, val)
}
60459
func (f *Request) MaxElapsedTime(me time.Duration) *Request {
	f.backoff.MaxElapsedTime = me
	return f
}
1134617
func (soc *Socket) SetVmciBufferMaxSize(value uint64) error {
	if minor < 2 {
		return ErrorNotImplemented42
	}
	return soc.setUInt64(C.ZMQ_VMCI_BUFFER_MAX_SIZE, value)
}
883530
func (soc *Socket) GetSndtimeo() (time.Duration, error) {
	major, minor, _ := Version()
	if major == 2 && minor < 2 {
		return 0, ErrorNotImplemented
	}
	v, err := soc.getInt(C.ZMQ_SNDTIMEO)
	if v < 0 {
		return time.Duration(-1), err
	}
	return time.Duration(v) * time.Millisecond, err
}
546497
func InitialVirtualTime(t time.Time) setVirtualTimerPolicyOption {
	return func(p Params) {
		p["initialVirtualTime"] = float64(t.Unix())
	}
}
1125976
func (soc *Socket) GetRecoveryIvl() (time.Duration, error) {
	v, e := soc.getInt64(C.ZMQ_RECOVERY_IVL)
	return time.Duration(v) * time.Second, e
}
56590
func RTClock(clock timetools.TimeProvider) rrOptSetter {
	return func(r *RTMetrics) error {
		r.clock = clock
		return nil
	}
}