mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #84781 from Gerry-Lee/UseTimeUtilInsteadOfTimeSub
Use time.Until instead of t.Sub(time.Now())
This commit is contained in:
commit
17874d6db3
@ -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