// willExpireIn returns true if the Token will expire after the passed time.Duration interval
// from now, false otherwise.
974056
func (t token) willExpireIn(d time.Duration) bool {
	s, err := strconv.Atoi(t.ExpiresOn)
	if err != nil {
		s = -3600
	}
	expiryTime := expirationBase.Add(time.Duration(s) * time.Second).UTC()

	return !expiryTime.After(time.Now().Add(d))
}
1134871
func (t *Token) expired() bool {
	if t.Expiry.IsZero() {
		return false
	}
	return t.Expiry.Round(0).Add(-expiryDelta).Before(timeNow())
}
1031595
func (t *token) Expired() bool {
	if t == nil {
		return true
	}
	return !t.Token.Valid()
}
341560
func (s *Store) expirer() {
	defer s.wg.Done()

	ticker := time.NewTicker(s.ExpiryCheckInterval)
	defer ticker.Stop()

	for {
		// Wait for next check or for close signal.
		select {
		case <-s.closing:
			return
		case <-ticker.C:
		}

		// Check all instances for expiration.
		if err := s.EnforceExpiry(); err != nil && err != raft.ErrNotLeader {
			s.logger.Printf("enforce expiry: %s", err)
		}
	}
}
520838
func (s *Activation) SetExpired(v bool) *Activation {
	s.Expired = &v
	return s
}
1057991
func Expiry(clock clockwork.Clock, ttl time.Duration) time.Time {
	if ttl == 0 {
		return time.Time{}
	}
	return clock.Now().UTC().Add(ttl)
}
443590
func (r *RoleV3) SetExpiry(expires time.Time) {
	r.Metadata.SetExpiry(expires)
}
35792
func (c Claims) Expiration() (time.Time, bool) {
	return jwt.Claims(c).Expiration()
}
1188729
func (c Claims) SetExpiration(expiration time.Time) {
	jwt.Claims(c).SetExpiration(expiration)
}
948115
func checkExpiration(body *tokenserver.MachineTokenBody, now time.Time) error {
	notBefore := time.Unix(int64(body.IssuedAt), 0)
	notAfter := notBefore.Add(time.Duration(body.Lifetime) * time.Second)
	if now.Before(notBefore.Add(-allowedClockDrift)) {
		diff := notBefore.Sub(now)
		return fmt.Errorf("token is not valid yet, will be valid in %s", diff)
	}
	if now.After(notAfter.Add(allowedClockDrift)) {
		diff := now.Sub(notAfter)
		return fmt.Errorf("token expired %s ago", diff)
	}
	return nil
}
498718
func (n *Namespace) SetExpiry(expires time.Time) {
	n.Metadata.SetExpiry(expires)
}
463630
func (rkv *KeyValue) SetExpire(key, value string, expire time.Duration) error {
	conn := rkv.pool.Get(rkv.dbindex)
	// Convert from nanoseconds to milliseconds
	expireMilliseconds := expire.Nanoseconds() / 1000000
	// Set the value, together with an expiry time, given in milliseconds
	_, err := conn.Do("SET", rkv.id+":"+key, value, "PX", expireMilliseconds)
	return err
}
1083434
func (m *MockAccessResponder) SetExpiresIn(arg0 time.Duration) {
	m.ctrl.Call(m, "SetExpiresIn", arg0)
}
1174278
func (e *Expiry) IsExpired() bool {
	curTime := e.CurrentTime
	if curTime == nil {
		curTime = time.Now
	}
	return e.expiration.Before(curTime())
}
1121653
func (c *Credentials) Expire() {
	c.Lock()
	defer c.Unlock()

	c.forceRefresh = true
}
389423
func (c *StaticTokensV2) SetExpiry(expires time.Time) {
	c.Metadata.SetExpiry(expires)
}
778368
func (at *AccessToken) IsExpiredAt(testtime time.Time) bool {
	return testtime.After(at.ExpirationTime())
}