// PurgeTimestamps implements TimestampPurger.
197802
func (a *Attempt) PurgeTimestamps() {
	if a == nil {
		return
	}
	a.Data.PurgeTimestamps()

	for _, e := range a.Executions {
		e.PurgeTimestamps()
	}
}
1218284
func (t *TSCache) Purge() {
	t.mux.Lock()
	defer t.mux.Unlock()
	n := 0
	for k, v := range t.table {
		if time.Now().Sub(v) > t.ttl {
			delete(t.table, k)
			n++
		}
	}
	log.Printf("D! [inputs.vsphere] Purged timestamp cache. %d deleted with %d remaining", n, len(t.table))
}
851911
func s_workers_purge(workers []worker_t) []worker_t {
	now := time.Now()
	for i, worker := range workers {
		if now.Before(worker.expire) {
			return workers[i:] //  Worker is alive, we're done here
		}
	}
	return workers[0:0]
}
722607
func ConvertToTimestamp(timeString string) *Timestamp {
	parsed, _ := time.Parse(time.RFC3339Nano, timeString)
	return &Timestamp{parsed}
}
860957
func MustTimestampProto(t time.Time) *gogotypes.Timestamp {
	ts, err := gogotypes.TimestampProto(t)
	if err != nil {
		panic(err.Error())
	}
	return ts
}
669180
func (bucket *kbucket) UpdateTimestamp() {
	bucket.Lock()
	defer bucket.Unlock()

	bucket.lastChanged = time.Now()
}
783779
func (s *ThingConnectivity) SetTimestamp(v int64) *ThingConnectivity {
	s.Timestamp = &v
	return s
}
663508
func ClockTimestamp(db XODB) (time.Time, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.clock_timestamp()`

	// run query
	var ret time.Time
	XOLog(sqlstr)
	err = db.QueryRow(sqlstr).Scan(&ret)
	if err != nil {
		return time.Time{}, err
	}

	return ret, nil
}
379688
func (s *SamplingStatisticsDocument) SetTimestamp(v time.Time) *SamplingStatisticsDocument {
	s.Timestamp = &v
	return s
}
526098
func (s *FileSystemSize) SetTimestamp(v time.Time) *FileSystemSize {
	s.Timestamp = &v
	return s
}
645192
func (ttl *SnapshotTTL) Purge(age time.Duration) (time.Duration, error) {
	ctx := datastore.Get()
	defer ctx.Metrics().Stop(ctx.Metrics().Start("SnapshotTTL.Purge"))

	logger := plog.WithField("age", int(age.Minutes()))

	expire := time.Now().Add(-age)
	var tenantIDs []string
	var unused struct{}
	if err := ttl.client.GetTenantIDs(unused, &tenantIDs); err != nil {
		logger.WithError(err).Error("Could not look up tenantIDs")
		return 0, err
	}

	for _, tenantID := range tenantIDs {
		var snapshots []dao.SnapshotInfo
		if err := ttl.client.ListSnapshots(tenantID, &snapshots); err != nil {
			logger.WithField("tenantid", tenantID).
				WithError(err).Error("Could not look up snapshots for tenant service")
			return 0, err
		}
		for _, s := range snapshots {
			//ignore snapshots that have any tag
			if len(s.Tags) == 0 {
				// check the age of the snapshot
				if timeToLive := s.Created.Sub(expire); timeToLive <= 0 {
					snapshotLogger := logger.WithFields(log.Fields{
						"tenantid": tenantID,
						"snapshotid": s.SnapshotID,
					})
					if err := ttl.client.DeleteSnapshot(s.SnapshotID, nil); err != nil {
						snapshotLogger.WithError(err).Error("Could not delete snapshot")
						return 0, err
					}
					snapshotLogger.Debug("Deleted snapshot")
				} else if timeToLive < age {
					// set the new time to live based on the age of the
					// oldest non-expired snapshot.
					age = timeToLive
				}
			}
		}
	}
	logger.WithField("age", int(age.Minutes())).Debug("Finished Purge")

	return age, nil
}
1171432
func (s *StackResource) SetTimestamp(v time.Time) *StackResource {
	s.Timestamp = &v
	return s
}
788062
func (b *BackgroundEphemeralPurger) queuePurges(ctx context.Context) bool {
	defer b.Trace(ctx, func() error { return nil }, "queuePurges")()
	b.queueLock.Lock()
	defer b.queueLock.Unlock()

	i := 0
	// Peek into the queue for any expired convs
	for _, item := range b.pq.queue {
		purgeInfo := item.purgeInfo
		now := b.clock.Now()
		nextPurgeTime := purgeInfo.NextPurgeTime.Time()
		if nextPurgeTime.Before(now) || nextPurgeTime.Equal(now) {
			b.addPurgeToConvLoaderLocked(ctx, purgeInfo)
			// Don't spam out to the convloader
			if i > 0 {
				b.Debug(ctx, "queuePurges sleeping for %v", b.delay)
				b.clock.Sleep(b.delay)
			}
			i++
		} else {
			break
		}
	}
	// Maintain the queue and pop off any items we just sent off for purging
	for i > 0 {
		heap.Pop(b.pq)
		i--
	}

	nextItem := b.pq.Peek()
	if nextItem == nil {
		return true
	}
	// Reset our time for the next min item of the queue.
	b.resetTimer(ctx, nextItem.purgeInfo)
	return false
}
36747
func (s *MetricData) SetTimestamp(v time.Time) *MetricData {
	s.Timestamp = &v
	return s
}
1260943
func (s *CelebrityRecognition) SetTimestamp(v int64) *CelebrityRecognition {
	s.Timestamp = &v
	return s
}
986635
func (s *FilteredLogEvent) SetTimestamp(v int64) *FilteredLogEvent {
	s.Timestamp = &v
	return s
}
202411
func (s *DataPoint) SetTimestamp(v time.Time) *DataPoint {
	s.Timestamp = &v
	return s
}