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

Function relativeTimeStr

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

Source from the content-addressed store, hash-verified

477}
478
479func relativeTimeStr(t time.Time) string {
480 d := time.Since(t)
481 switch {
482 case d < time.Minute:
483 return "just now"
484 case d < time.Hour:
485 return fmt.Sprintf("%dm ago", int(d.Minutes()))
486 case d < 24*time.Hour:
487 return fmt.Sprintf("%dh ago", int(d.Hours()))
488 default:
489 return fmt.Sprintf("%dd ago", int(d.Hours()/24))
490 }
491}
492
493// --- database tools ---
494

Callers 2

githubStatusCmdFunction · 0.85
showItemPRStatusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected