Skip to main content

rel_time

Function rel_time 

Source
pub fn rel_time(epoch: i64) -> String
Expand description

Render an epoch timestamp as a human-friendly relative time.

  • 0
  • |delta| < 5sjust now
  • < 60s12s ago / in 12s
  • < 1h3m ago / in 3m
  • < 1d2h ago / in 2h
  • < 1w5d ago / in 5d
  • otherwise → %b %e (e.g. Jan 12)