(t time.Time)
| 477 | } |
| 478 | |
| 479 | func 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 |
no outgoing calls
no test coverage detected