fork(2) download
  1. duration1 = 63000 # expected value: 17 h 30 m
  2. duration2 = 28800 # expected value: 8 h
  3. duration3 = 1800 # expected value: 30 m
  4.  
  5. puts(Time.at(duration1).utc.strftime('%H h %M m').gsub(/\b(?:00 [hm]|0(?=[1-9] [hm]))\s*/, ''))
  6. puts(Time.at(duration2).utc.strftime('%H h %M m').gsub(/\b(?:00 [hm]|0(?=[1-9] [hm]))\s*/, ''))
  7. puts(Time.at(duration3).utc.strftime('%H h %M m').gsub(/\b(?:00 [hm]|0(?=[1-9] [hm]))\s*/, ''))
  8.  
Success #stdin #stdout 0.01s 6276KB
stdin
Standard input is empty
stdout
17 h 30 m
8 h 
30 m