format_duration

Function format_duration 

Source
pub fn format_duration(total_seconds: u32) -> String
Expand description

Creates string representation as bytes, compatible with Erlang’s :erlang.integer_to_binary/1 Format a duration into human-readable form following the requirements:

  • seconds if less than a minute
  • minutes plus seconds if less than hour
  • hours and minutes if less than day
  • days and hours if less than month
  • months and days if less than year
  • years, months and days if bigger than year