Skip to content

Instantly share code, notes, and snippets.

@kencoba
Created June 14, 2017 08:29
Show Gist options
  • Save kencoba/44eb0bd2c06200776977e80f7d3562dd to your computer and use it in GitHub Desktop.
Save kencoba/44eb0bd2c06200776977e80f7d3562dd to your computer and use it in GitHub Desktop.
convert interval into hms format.
interval = gets.to_i
sec = interval % 60
hour = interval / (60 * 60)
min = (interval - (hour * 60 * 60)) / 60
printf("%02d:%02d:%02d", hour, min, sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment