MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / relativeTimeStr

Function relativeTimeStr

cmd/pad/cmd_github.go:419–431  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

417}
418
419func relativeTimeStr(t time.Time) string {
420 d := time.Since(t)
421 switch {
422 case d < time.Minute:
423 return "just now"
424 case d < time.Hour:
425 return fmt.Sprintf("%dm ago", int(d.Minutes()))
426 case d < 24*time.Hour:
427 return fmt.Sprintf("%dh ago", int(d.Hours()))
428 default:
429 return fmt.Sprintf("%dd ago", int(d.Hours()/24))
430 }
431}
432
433// --- database tools ---

Callers 2

githubStatusCmdFunction · 0.85
showItemPRStatusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected