This commit is contained in:
Josh Deprez 2024-04-26 12:18:17 +10:00
parent db32d69d65
commit fc2e385efc
No known key found for this signature in database

View file

@ -360,14 +360,14 @@ type AMTEntry struct {
}
// Valid reports if the entry is valid.
func (e *AMTEntry) Valid() bool {
return e != nil && time.Since(e.LastUpdated) < maxAMTEntryAge
func (e AMTEntry) Valid() bool {
return time.Since(e.LastUpdated) < maxAMTEntryAge
}
// LastUpdatedAgo is a friendly string reporting how long ago the entry was
// updated/resolved.
func (e *AMTEntry) LastUpdatedAgo() string {
if e == nil || e.LastUpdated.IsZero() {
func (e AMTEntry) LastUpdatedAgo() string {
if e.LastUpdated.IsZero() {
return "never"
}
return fmt.Sprintf("%v ago", time.Since(e.LastUpdated).Truncate(time.Millisecond))