// period returns the resolution of metrics.
515745
func period(start, end time.Time) time.Duration {
	switch n := end.Sub(start).Hours(); {
	case n > 24:
		return time.Hour * 24
	default:
		return time.Hour
	}
}
361180
func (f *CGroupFingerprint) Periodic() (bool, time.Duration) {
	return true, interval * time.Second
}
387515
func (fs *FlagSet) Duration(names []string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	fs.DurationVar(p, names, value, usage)
	return p
}
423141
func (r Range) Duration() time.Duration {
	return r.End.Sub(r.Start)
}
671562
func (s *MetricStat) SetPeriod(v int64) *MetricStat {
	s.Period = &v
	return s
}
688281
func (h *Hosts) Period() time.Duration {
	if h.Stopped() {
		return -1
	}

	h.mux.RLock()
	defer h.mux.RUnlock()

	return h.period
}
1362657
func (s *CloudWatchAlarmDefinition) SetPeriod(v int64) *CloudWatchAlarmDefinition {
	s.Period = &v
	return s
}
704798
func (g *Generator) SetLinuxResourcesCPUPeriod(period uint64) {
	g.InitConfigLinuxResourcesCPU()
	g.Config.Linux.Resources.CPU.Period = &period
}
1146637
func Round(value time.Duration, resolution time.Duration) time.Duration {
	if value < 0 {
		value -= resolution / 2
	} else {
		value += resolution / 2
	}
	return value / resolution * resolution
}
1059172
func (c *Counter) Metric() (*metricpb.Metric, error) {
	return &metricpb.Metric{
		Name:  c.Name,
		Tags:  c.Tags,
		Type:  metricpb.Type_Counter,
		Value: &metricpb.Metric_Counter{&metricpb.CounterValue{Value: c.value}},
	}, nil
}
958355
func (c *Client) Duration(stat string, duration time.Duration, rate float64) error {
	return c.send(stat, rate, "%d|ms", millisecond(duration))
}
800624
func (c *Client) Duration(name string, duration time.Duration) error {
	return c.send(name, 1, "%d|ms", millisecond(duration))
}
1068372
func (a *AuthServer) runPeriodicOperations() {
	// run periodic functions with a semi-random period
	// to avoid contention on the database in case if there are multiple
	// auth servers running - so they don't compete trying
	// to update the same resources.
	r := rand.New(rand.NewSource(a.GetClock().Now().UnixNano()))
	period := defaults.HighResPollingPeriod + time.Duration(r.Intn(int(defaults.HighResPollingPeriod/time.Second)))*time.Second
	log.Debugf("Ticking with period: %v.", period)
	ticker := time.NewTicker(period)
	defer ticker.Stop()
	for {
		select {
		case <-a.closeCtx.Done():
			return
		case <-ticker.C:
			err := a.autoRotateCertAuthorities()
			if err != nil {
				if trace.IsCompareFailed(err) {
					log.Debugf("Cert authority has been updated concurrently: %v.", err)
				} else {
					log.Errorf("Failed to perform cert rotation check: %v.", err)
				}
			}
		}
	}
}
18100
func (s *DescribeAlarmsForMetricInput) SetPeriod(v int64) *DescribeAlarmsForMetricInput {
	s.Period = &v
	return s
}
218099
func (s *GetInstanceMetricDataInput) SetPeriod(v int64) *GetInstanceMetricDataInput {
	s.Period = &v
	return s
}
746363
func (a *HistogramAggregation) Interval(interval float64) *HistogramAggregation {
	a.interval = interval
	return a
}
866268
func (d Duration) Minute() int {
	_, _, minute, _, _ := splitDuration(d.Duration)
	return minute
}