time conversion hackerrank solution in c