// GetNextPingSlotAfter returns the next pingslot occuring after the given gps epoch timestamp.
494816
func GetNextPingSlotAfter(afterGPSEpochTS time.Duration, devAddr lorawan.DevAddr, pingNb int) (time.Duration, error) {
	if pingNb == 0 {
		return 0, errors.New("pingNb must be > 0")
	}
	beaconStart := afterGPSEpochTS - (afterGPSEpochTS % beaconPeriod)
	pingPeriod := pingPeriodBase / pingNb

	for {
		pingOffset, err := GetPingOffset(beaconStart, devAddr, pingNb)
		if err != nil {
			return 0, err
		}

		for n := 0; n < pingNb; n++ {
			gpsEpochTime := beaconStart + beaconReserved + (time.Duration(pingOffset+n*pingPeriod) * slotLen)

			if gpsEpochTime > afterGPSEpochTS {
				log.WithFields(log.Fields{
					"dev_addr":                   devAddr,
					"beacon_start_time_s":        int(beaconStart / beaconPeriod),
					"after_beacon_start_time_ms": int((gpsEpochTime - beaconStart) / time.Millisecond),
					"ping_offset_ms":             pingOffset,
					"ping_slot_n":                n,
					"ping_nb":                    pingNb,
				}).Info("get next ping-slot timestamp")
				return gpsEpochTime, nil
			}
		}

		beaconStart += beaconPeriod
	}
}
319441
func (s *ListWebACLsInput) SetNextMarker(v string) *ListWebACLsInput {
	s.NextMarker = &v
	return s
}
603768
func (ps Points) SearchNextIndex(x float64) int {
	sf := func(i int) bool {
		return x < ps[i].X()
	}
	return sort.Search(len(ps), sf)
}
1120308
func (ctx *protoKeyValIterator) GetNext() (kv keyval.ProtoKeyVal, stop bool) {
	pair, stop := ctx.delegate.GetNext()
	if stop {
		return nil, stop
	}

	return &protoKeyVal{pair, ctx.serializer}, stop
}
792461
func (s *OriginAccessIdentityList) SetNextMarker(v string) *OriginAccessIdentityList {
	s.NextMarker = &v
	return s
}
1064002
func (s *ListResourceTagsOutput) SetNextMarker(v string) *ListResourceTagsOutput {
	s.NextMarker = &v
	return s
}
1009314
func (s *ListCACertificatesOutput) SetNextMarker(v string) *ListCACertificatesOutput {
	s.NextMarker = &v
	return s
}
450502
func (s *ListPrincipalPoliciesOutput) SetNextMarker(v string) *ListPrincipalPoliciesOutput {
	s.NextMarker = &v
	return s
}
693319
func (c TeamsClient) FindNextMerkleRootAfterTeamRemoval(ctx context.Context, __arg FindNextMerkleRootAfterTeamRemovalArg) (res NextMerkleRootRes, err error) {
	err = c.Cli.Call(ctx, "keybase.1.teams.findNextMerkleRootAfterTeamRemoval", []interface{}{__arg}, &res)
	return
}
1219570
func (s *GetRateBasedRuleManagedKeysInput) SetNextMarker(v string) *GetRateBasedRuleManagedKeysInput {
	s.NextMarker = &v
	return s
}
712749
func (allocated *allocatedMap) getNextIP() (net.IP, error) {
	pos := big.NewInt(0).Set(allocated.last)
	allRange := big.NewInt(0).Sub(allocated.end, allocated.begin)
	for i := big.NewInt(0); i.Cmp(allRange) <= 0; i.Add(i, big.NewInt(1)) {
		pos.Add(pos, big.NewInt(1))
		if pos.Cmp(allocated.end) == 1 {
			pos.Set(allocated.begin)
		}
		if _, ok := allocated.p[bigIntToIP(pos).String()]; ok {
			continue
		}
		allocated.p[bigIntToIP(pos).String()] = struct{}{}
		allocated.last.Set(pos)
		return bigIntToIP(pos), nil
	}
	return nil, ErrNoAvailableIPs
}
1176608
func (s *ListIPSetsOutput) SetNextMarker(v string) *ListIPSetsOutput {
	s.NextMarker = &v
	return s
}
382937
func (m *Memberlist) pushPullTrigger(stop <-chan struct{}) {
	interval := m.config.PushPullInterval

	// Use a random stagger to avoid syncronizing
	randStagger := time.Duration(uint64(rand.Int63()) % uint64(interval))
	select {
	case <-time.After(randStagger):
	case <-stop:
		return
	}

	// Tick using a dynamic timer
	for {
		tickTime := pushPullScale(interval, m.estNumNodes())
		select {
		case <-time.After(tickTime):
			m.pushPull()
		case <-stop:
			return
		}
	}
}
1050772
func (s *ListXssMatchSetsInput) SetNextMarker(v string) *ListXssMatchSetsInput {
	s.NextMarker = &v
	return s
}
1066822
func (s *ListRateBasedRulesInput) SetNextMarker(v string) *ListRateBasedRulesInput {
	s.NextMarker = &v
	return s
}
342257
func (s *ListTargetsForPolicyOutput) SetNextMarker(v string) *ListTargetsForPolicyOutput {
	s.NextMarker = &v
	return s
}
570557
func getLastChangeTriggerTime(endpoints *v1.Endpoints) time.Time {
	if _, ok := endpoints.Annotations[v1.EndpointsLastChangeTriggerTime]; !ok {
		// It's possible that the Endpoints object won't have the EndpointsLastChangeTriggerTime
		// annotation set. In that case return the 'zero value', which is ignored in the upstream code.
		return time.Time{}
	}
	val, err := time.Parse(time.RFC3339Nano, endpoints.Annotations[v1.EndpointsLastChangeTriggerTime])
	if err != nil {
		klog.Warningf("Error while parsing EndpointsLastChangeTriggerTimeAnnotation: '%s'. Error is %v",
			endpoints.Annotations[v1.EndpointsLastChangeTriggerTime], err)
		// In case of error val = time.Zero, which is ignored in the upstream code.
	}
	return val
}