/*
Returns Push status for TimeSeries data-store for a key-val for given timestamp
Default is Key Namespace-d with Time-Namespace under it
*/
963763
func (namespace *Namespace) PushTSDS(key string, val string, key_time goltime.Timestamp) bool {
	return namespace.PushTSDS_BaseKey(key, val, key_time)
}
984957
func (namespace *Namespace) PushNS(key string, val string) bool {
	return namespace.ns.PushNS(key, val)
}
1348423
func decodeTimestamp(rd *bufio.Reader) (string, Timestamp, error) {
	// name
	name, err := readCstring(rd)
	if err != nil {
		return "", 0, err
	}

	// value
	i64, err := readInt64(rd)
	if err != nil {
		return "", 0, err
	}
	return name, Timestamp(i64), nil
}
16212
func ParseTimestamp(timestamp interface{}, format string) (time.Time, error) {
	return ParseTimestampWithLocation(timestamp, format, "UTC")
}
758230
func (p *PushEventCommit) GetTimestamp() Timestamp {
	if p == nil || p.Timestamp == nil {
		return Timestamp{}
	}
	return *p.Timestamp
}
350083
func (p *PushEventRepository) GetPushedAt() Timestamp {
	if p == nil || p.PushedAt == nil {
		return Timestamp{}
	}
	return *p.PushedAt
}
1022105
func (tc *TabletStatsCache) GetHealthyTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats {
	e := tc.getEntry(keyspace, shard, tabletType)
	if e == nil {
		return nil
	}

	e.mu.RLock()
	defer e.mu.RUnlock()
	result := make([]TabletStats, len(e.healthy))
	for i, ts := range e.healthy {
		result[i] = *ts
	}
	return result
}
614313
func (stub *ChaincodeStub) GetTxTimestamp() (*timestamp.Timestamp, error) {
	hdr, err := utils.GetHeader(stub.proposal.Header)
	if err != nil {
		return nil, err
	}
	chdr, err := utils.UnmarshalChannelHeader(hdr.ChannelHeader)
	if err != nil {
		return nil, err
	}

	return chdr.GetTimestamp(), nil
}
1052714
func (v *Value) ToTimestamp() (t time.Time, ok bool) {
	switch v.vType {
	case typeTimestamp:
		return v.value.(time.Time), true
	}
	return t, false
}
22820
func ReadTimestamps(bkt *bolt.Bucket, created, updated *time.Time) error {
	for _, f := range []struct {
		b []byte
		t *time.Time
	}{
		{bucketKeyCreatedAt, created},
		{bucketKeyUpdatedAt, updated},
	} {
		v := bkt.Get(f.b)
		if v != nil {
			if err := f.t.UnmarshalBinary(v); err != nil {
				return err
			}
		}
	}
	return nil
}
1030404
func initStatsdTicker(ctx context.Context, config *types.Statsd) *time.Ticker {
	address := config.Address
	if len(address) == 0 {
		address = "localhost:8125"
	}
	pushInterval, err := time.ParseDuration(config.PushInterval)
	if err != nil {
		log.FromContext(ctx).Warnf("Unable to parse %s from config.PushInterval: using 10s as the default value", config.PushInterval)
		pushInterval = 10 * time.Second
	}

	report := time.NewTicker(pushInterval)

	safe.Go(func() {
		statsdClient.SendLoop(report.C, "udp", address)
	})

	return report
}
39346
func (s *IndexService) Timestamp(timestamp string) *IndexService {
	s.timestamp = timestamp
	return s
}
941032
func (qri *QueryRespItem) getSortedTimestampStrs() []string {
	timestampStrs := make([]string, 0)
	for timestampStr := range qri.Dps {
		timestampStrs = append(timestampStrs, timestampStr)
	}
	sort.Strings(timestampStrs)
	return timestampStrs
}
1253193
func (s *Service) CheckTimestamp(timestampHeader string) (bool, error) {
	// convert unix timestamp string into time struct
	timestamp, err := strconv.ParseInt(timestampHeader, 10, 0)
	if err != nil {
		return false, fmt.Errorf("unable to parse %v: %v", s.config.TimestampHeaderName, timestampHeader)
	}

	now := s.clock.Now().UTC().Unix()

	// if timestamp is from the future, it's invalid
	if timestamp >= now+MaxSkewSec {
		return false, fmt.Errorf("timestamp header from the future; now: %v; %v: %v; difference: %v",
			now, s.config.TimestampHeaderName, timestamp, timestamp-now)
	}

	// if the timestamp is older than ttl - skew, it's invalid
	if timestamp <= now-int64(s.nonceCache.cacheTTL-MaxSkewSec) {
		return false, fmt.Errorf("timestamp header too old; now: %v; %v: %v; difference: %v",
			now, s.config.TimestampHeaderName, timestamp, now-timestamp)
	}

	return true, nil
}
388860
func (w *WebHookCommit) GetTimestamp() time.Time {
	if w == nil || w.Timestamp == nil {
		return time.Time{}
	}
	return *w.Timestamp
}
446711
func (c *ReactionsRemoveCall) Timestamp(timestamp string) *ReactionsRemoveCall {
	c.timestamp = timestamp
	return c
}
8347
func (namespace *Namespace) KeyAndTimeBothNameSpace(key string, key_time goltime.Timestamp) (string, string) {
	time_ns := namespace.TimeKeyPart(key_time)
	return fmt.Sprintf("%s:%s", key, time_ns), fmt.Sprintf("%s:%s", time_ns, key)
}