(t time.Time)
| 417 | } |
| 418 | |
| 419 | func 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 --- |
no outgoing calls
no test coverage detected