mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
use time.Until instead of t.Sub(time.Now())
This commit is contained in:
parent
3e5f6bdaa4
commit
696734a772
@ -287,7 +287,7 @@ func formatBootstrapToken(obj *outputapiv1alpha1.BootstrapToken) string {
|
||||
ttl := "<forever>"
|
||||
expires := "<never>"
|
||||
if obj.Expires != nil {
|
||||
ttl = duration.ShortHumanDuration(obj.Expires.Sub(time.Now()))
|
||||
ttl = duration.ShortHumanDuration(time.Until(obj.Expires.Time))
|
||||
expires = obj.Expires.Format(time.RFC3339)
|
||||
}
|
||||
ttl = fmt.Sprintf("%-9s", ttl)
|
||||
|
@ -48,5 +48,5 @@ func newExpirationInfo(name string, cert *x509.Certificate, externallyManaged bo
|
||||
|
||||
// ResidualTime returns the time missing to expiration
|
||||
func (e *ExpirationInfo) ResidualTime() time.Duration {
|
||||
return e.ExpirationDate.Sub(time.Now())
|
||||
return time.Until(e.ExpirationDate)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user